When trying to access the search endpoint (https://example.sharepoint.com/_api/search/query) I always manage to bump into exceptions. I can't seem to find any reference to what is the correct App permissions XML that I should use for the App Principal.
I have tried this:
<AppPermissionRequests> <AppPermissionRequest Scope="http://sharepoint/search" Right="QueryAsUserIgnoreAppPrincipal" /> </AppPermissionRequests>
And I got this:
System.UnauthorizedAccessException: Access denied. You do not have permission to perform this action or access this resource.
and I also tried this:
<AppPermissionRequests AllowAppOnlyPolicy="true"> <AppPermissionRequest Scope="http://sharepoint/content/sitecollection" Right="Read" /> </AppPermissionRequests>
and I got this:
Microsoft.Office.Server.Search.REST.SearchServiceException: Application does not have administrative permissions in tenant
Any ideas on how should the XML look like, to have the minimum permissions to allow access to the query api endpoint?