Sharepoint API to get list of all sites returning only partial result.

Copper Contributor

I was trying to get the list of all SharePoint sites (subsites not included) for my SharePoint, for which I came up with the following API.

 

https://zxxxxxxxx.sharepoint.com/_api/search/query?querytext='contentclass:STS_Site'  

 

Initially, during setup, I have created several sites (team sites, communication sites) and the above API returned the list of all APIs.

 

But eventually, when I tried after a few days, it stopped returning some of the sites, (particularly some of the Team sites). 

 

Unsure of the reason, I tried to edit and republish a few team sites and the API response included those sites.

 

I need an API to get all the sites at any point in time.  I do not wt to republish every time. Am I missing something here?

As an alternative approach, I tried graph APIs to get the list of sites. It always threw 503 Service unavailable.

 

Can anyone help me out with this.

0 Replies