I'm currently working on an iOS app which uses _api-services to retrieve data stored in documents libraries of a SharePoint Online. Consuming _api/web/Lists/ works well so far. At the moment the REST service URL is fixed for each site i want to access.

What I need is a way to retrieve all available sites genericly, so that the users only have to enter their toplevel site and credentials and all available sites will be listed. So I need a service call which delievers me the [site]-information for triggering further calls on the related subsites.


Does the REST _api offer a possibility to get all sites and subsites or even the whole site structure?

Thanks for any advice solving my problem

2 Answers 2


How to retrieve sub webs under root web

The following REST endpoint


will return the collection of sub webs (WebInfo objects) under root web

How to retrieve sub webs under relative web

Assume the following site structure:

-- Root
    -- Community
       -- Feedback 

Then the following REST endpoint:


will return the Feedback sub web under Community web

  • 1
    thanks for the quick answer. this is working relative to a specific site but when i trigger this service relative to the toplevel site i get an empty response { "d": { "results": [] } }
    – frank
    Commented Mar 7, 2014 at 11:18
  • @franqus, the answer has been updated Commented Mar 7, 2014 at 11:50
  • 5
    Calling the /_api/web/webinfos-endpoint on some subsites it returns me { "error": { "code": "-2147024891, System.UnauthorizedAccessException", "message": { "lang": "en-US", "value": "Access denied. You do not have permission to perform this action or access this resource." } } } even if i can visit the sites in the browser with the same account and not getting permission problems. any idea?
    – frank
    Commented Mar 10, 2014 at 8:26

If the users have sufficient permissions you can use webinfos. But sometimes users do not have access to some of the subsites. Then SharePoint pops up the login prompt and the call does not work (401 error). In this case you have to use /_api/web/Webs and set effectivebasepermissions in the query string.

I have written a relevant post here http://gbasagiannis.me/2016/01/27/find-first-level-subsites-sharepoint-2013-with-rest-api/

  • link is broken. Commented May 21, 2020 at 12:58

Your Answer

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

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