I'm looking for a way to get the list of site collections for my O365 Subscriptions. Now I have come across various answers to this but NONE of them works for me. I am using Client Credentials Flow to get the access token which means >>> APP Only Token. I have tried
https://{tenantName}-admin.sharepoint.com/_api/search/query?querytext='contentclass:sts_site'
and I get
500 Internal server error
{
"error": {
"code": "-1, Microsoft.Office.Server.Search.REST.SearchServiceException",
"message": {
"lang": "en-US",
"value": "An unknown error occurred."
}
}
}
I have come across the following links
What is the REST endpoint URL to get list of site collections?
Powershell to list all sites and subsites in SharePoint Online
https://gallery.technet.microsoft.com/office/How-to-get-all-the-tenant-2999c21b
http://blah.winsmarts.com/2014-4-Get_list_of_site_collections_using_CSOM_in_Office365.aspx
And
The last link appeared to be promising and I created the LIST(QueryPropertiesTemplate) as mentioned, but how am I supposed to get the FARM ID? Since this is Sharepoint Online and not on premise.
Any help with this?