404 Not Found - SharePoint Server 2016 - POSTMAN REST API

%3CLINGO-SUB%20id%3D%22lingo-sub-1144461%22%20slang%3D%22en-US%22%3E404%20Not%20Found%20-%20SharePoint%20Server%202016%20-%20POSTMAN%20REST%20API%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1144461%22%20slang%3D%22en-US%22%3E%3CP%3ETry%20as%20I%20might%20to%20create%20the%20URL%20in%20Postman%2C%20I%20am%20constantly%20getting%20a%20404%20Not%20Found%20error%20when%20I%20try%20and%20GET%20a%20document%20(basically%20a%20file%20exists%20check).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20accessing%20SharePoint%20on%20premises%202016%20and%20have....%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EHeaders%3A%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3EUser-Agent%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3EX-RequestDigest%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3CSPAN%3EAuthorization%3A%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3EUsername%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3EPassword%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EThis%20is%20the%20URL%20format%3A%3CBR%20%2F%3Ehttps%3A%2F%2F%7Bserver%7D%2F%7Bsite-relative-path%7D%2F_api%2Fv2.0%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20not%20sure%20whether%20the%20library%20name%20goes%20in%20the%20site%20relative%20path%20or%20under%20the%20server%20but%20tried%20everything%20and%20I've%20used%20GetFolderByRelativeServerUrl%20for%20the%20site%20relative%20path.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20pointers%20anyone%20please%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1144461%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3E2016%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Server%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1326456%22%20slang%3D%22en-US%22%3ERe%3A%20404%20Not%20Found%20-%20SharePoint%20Server%202016%20-%20POSTMAN%20REST%20API%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1326456%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F317812%22%20target%3D%22_blank%22%3E%40Si_Da%3C%2FA%3E%26nbsp%3BYou%20got%20to%20make%20sure%26nbsp%3Bthat%20the%20user%20you%20are%20requesting%20the%20token%20on%20behalf%20of%20have%20access%20to%20the%20library%20where%20the%20document%20resides.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20api%20documentation%20is%20not%20great.%20We%20have%20found%20that%20doing%20it%20via%20Microsoft%20Graph%20is%20a%20better%20option%2C%20it%20may%20be%20a%20bit%20more%20laborious%26nbsp%3B%20but%20they%20have%20a%20Postman%20Collection%20which%20is%20great%20for%20getting%20started.%20You%20can%20see%20how%20here%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fuse-postman%3Fview%3Dgraph-rest-1.0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fuse-postman%3Fview%3Dgraph-rest-1.0%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWe%20have%20found%20that%20using%20relative%20path%20is%20very%20tricky%20and%20getting%20the%20right%20syntax%20have%20proven%20to%20be%20difficult.%20So%20we%20have%20stuck%20to%20using%20id's%20instead.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHope%20this%20is%20helpful%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor

Try as I might to create the URL in Postman, I am constantly getting a 404 Not Found error when I try and GET a document (basically a file exists check).

 

I am accessing SharePoint on premises 2016 and have....

Headers:
User-Agent
X-RequestDigest


Authorization:
Username
Password

 

This is the URL format:
https://{server}/{site-relative-path}/_api/v2.0

 

I'm not sure whether the library name goes in the site relative path or under the server but tried everything and I've used GetFolderByRelativeServerUrl for the site relative path.

 

Any pointers anyone please?

1 Reply

@Si_Da You got to make sure that the user you are requesting the token on behalf of have access to the library where the document resides.

 

The api documentation is not great. We have found that doing it via Microsoft Graph is a better option, it may be a bit more laborious  but they have a Postman Collection which is great for getting started. You can see how here: https://docs.microsoft.com/en-us/graph/use-postman?view=graph-rest-1.0

 

We have found that using relative path is very tricky and getting the right syntax have proven to be difficult. So we have stuck to using id's instead.

 

Hope this is helpful