0

My goal is to get all items or files names at this URL

https://myOrganization.sharepoint.com/sites/supplierABC/DataSheet/Forms/AllItems.aspx

I have followed this link and I already have client Id and client secret for the SharePoint URL by using them I am able to generate access token successfully. By using generated access token in Authorization (Postman header), I am trying a get request in Postman with URLs:

https://myOrganization.sharepoint.com/_api/web/lists/getbytitle('test')/items https://myOrganization.sharepoint.com/sites/supplierABC/DataSheet/Forms/AllItem.aspx/_api/web/lists/getbytitle('test')/items

My question here is which URL should be used before _api/web/lists/getbytitle('test')/items either

  1. https://myOrganization.sharepoint.com
    or
  2. https://myOrganization.sharepoint.com/sites/supplierABC/DataSheet/Forms/AllItems.aspx (files are present here)

1 Answer 1

2

Your REST URL should be:

_spPageContextInfo.webServerRelativeUrl + _api/web/lists/getbytitle('test')/items
3
  • @Anurag_BEHS Please don't forget to upvote and mark the answer as accepted in case it helped you! Commented Oct 7, 2018 at 6:54
  • Thanks a lot !!! for those who are new bee like me . we can get this _spPageContextInfo from the browser console of our share point url. After pressing f12 in browser -> go to console ->and hit _spPageContextInfo.webServerRelativeUrl -> you will get the answer. so complete url will be -> myOrganization.sharepoint.com + _spPageContextInfo.webServerRelativeUrl + _api/web/lists/getbytitle('test')/items ... Thanks a lot Sohail... Commented Oct 7, 2018 at 14:28
  • @Anurag_BEHS Pleasure Commented Oct 7, 2018 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.