Inconsistent responses from SharePoint365 API

Copper Contributor

We use the legacy Sharepoint API to ingest all content from not only SharepointOnline/365 but also Sharepoint 2013 and 2016.
Unfortunately, while ingesting data from a Sharepoint 365 site, the API is not behaving in a consistent way.
Consistently, it reports that certain items do not exist when the site has not been modified and we can see said items in the expected location.
For example:

DEBUG 2019-07-29 23:04:17,439 (Worker thread '0') - http-outgoing-129363 >> GET /sites/sonyhack/_api/web/GetFileByServerRelativeUrl('%2f%2fsites%2fsonyhackShared%20Documents%2fFinance-1%2fSPI%2fFinance%2f21-SOX%20-%20Internal%20Audit%2fFY14%2fRef%20%2317.6%20LON_Prod%20Acctg%20Fee_WE%20140302.xlsx') HTTP/1.1
DEBUG 2019-07-29 23:04:17,439 (Worker thread '0') - http-outgoing-129363 >> User-Agent: NONISV|Exonar|Slurp/1.0
DEBUG 2019-07-29 23:04:17,439 (Worker thread '0') - http-outgoing-129363 >> X-RequestDigest: 0x31C66DB00416F265FCD915032E30EF736B3AC796F59873EBF593105231E91D0683FD26F857E0854958C30C7D45AFD6CB5DA4B2DABC7D06133631A74FCA9A9F86,29 Jul 2019 22:40:45 -0000
DEBUG 2019-07-29 23:04:17,439 (Worker thread '0') - http-outgoing-129363 >> Host: exonarltd.sharepoint.com
DEBUG 2019-07-29 23:04:17,439 (Worker thread '0') - http-outgoing-129363 >> Connection: Keep-Alive
DEBUG 2019-07-29 23:04:17,439 (Worker thread '0') - http-outgoing-129363 >> Cookie: FedAuth=77u/PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48U1A+VjYsMGguZnxtZW1iZXJzaGlwfDEwMDM3ZmZlYTUwNzU0ZTJAbGl2ZS5jb20sMCMuZnxtZW1iZXJzaGlwfHN1cHBvcnRAZXhvbmFybHRkLm9ubWljcm9zb2Z0LmNvbSwxMzIwODg4NDgxNjAwMDAwMDAsMTMxNTIyNzA4MDQwMDAwMDAwLDEzMjA4OTg4OTEyNzA3MTQwOSwwLjAuMC4wLDIsMTF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QEUT2CgUUAAAA=
DEBUG 2019-07-29 23:04:17,439 (Worker thread '0') - http-outgoing-129363 >> Cookie2: $Version=1
DEBUG 2019-07-29 23:04:17,439 (Worker thread '0') - http-outgoing-129363 >> Accept-Encoding: gzip,deflate
DEBUG 2019-07-29 23:04:17,513 (Worker thread '0') - http-outgoing-129363 << HTTP/1.1 404 Not Found

And yet, the item is there, not having been modified for months.

 

In other situations, these failures are intermittent, with an item being reported as missing on one run to then be seen the next run and disappear again on the following run.

This makes us unable to get a consistent view on Sharepoint sites as, if one of those items is a folder, we end up not only not seeing it but any of the contents within.

 

Is this something others have experienced? Is there a workaround?

 

Thank you for your help

2 Replies
What do you mean by legacy API?

@Juan Carlos González Martín 

We authenticate with Sharepoint API using SharePoint App-Only principal as documented in https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly as our app way to run software that integrates with both online and on premises Sharepoint installations. That was what was meant with legacy.

Apologies.

 

The inconsistencies we are seeing are solely related to the Sharepoint REST API documented in https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/get-to-know-the-sharepoint-rest-service

 

For full clarity purposes, the endpoints we are having issues with are 

GetFileByServerRelativeUrl and GetFolderByServerRelativeUrl (described in https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-folders-and-files-with-rest ) which we use to navigate Sharepoint sites.