0

I have a sharepoint site hosted at:

https://xxxxx.sharepoint.com, which has a subsite named abc

when I type in https://xxxx.sharepoint.com/abc in the browser, it redirects to the welcome page of the subsite automatically, which is https://xxxxx.sharepoint.com/abc/Pages/Home.aspx.

But when I try to access this subsite using postman, it does not redirects to the welcome page by itself, even if I try to access the welcome page like this: https://xxxxx.sharepoint.com/abc/Pages/Home.aspx by using the oauth2 token, it gives error 401 unauthorized.

How to access the home page of a sharepoint subsite from postman and retrieve its HTML?

0

The Url of the designated "default" or "home" page is stored in a property named WelcomePage. To retrieve this value from a REST call, perform a GET "<<subsiteurlhere>>/_api/web/rootfolder?$select=welcomepage". Since it is a GET request, you can even test this in the browser, for example:

https://xxxxx.sharepoint.com/sites/abc/subweb1/_api/web/rootfolder?$select=welcomepage

Also note, that if you performed Oauth to get your token from the parent site, depending on how your permissions are configured, you may have to re-authenticate to get a valid token for the subsite.

Update from comments:

Hit the REST endpoint in browser tab like below and check if this works for you before using it in postman:

enter image description here

19
  • Tried it, like this xxxx.sharepoint.com/abc/pages/_api/web/…, but it gives me error this error: {"error_description":"Invalid issuer or signature."}. Using oauth2 Password credentials flow . – Surbhi Babbar Mar 2 '20 at 11:49
  • "/pages" is not part of your web URL – willman Mar 2 '20 at 12:07
  • shall it be literally used like this: xxx.sharepoint.com/abc/subweb1/_api/web/… – Surbhi Babbar Mar 2 '20 at 12:10
  • Also, how to handle error 401 . It shows me this in the response headers: x-ms-diagnostics →3000006;reason="Token contains invalid signature.";category="invalid_client" – Surbhi Babbar Mar 2 '20 at 12:10
  • The part that comes before the "_api" should only include the path to your site or subsite. Library or lists should not be in the base path. So if your site is xxxx.sharepoint.com/sites/abc, and the "abc" site has a subsite named subweb1, then the API call would be https://xxxxx.sharepoint.com/sites/abc/subweb1/_api/web/rootfolder?$select=welcomepage. Of course, you want to use real address of your site and subsite. – willman Mar 2 '20 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.