question

DavidPettitt-6572 avatar image
1 Vote"
DavidPettitt-6572 asked DavidPettitt-6572 commented

Why no response to Graph API reports query?

I am attempting to get reports data out of the Graph API. I get nothing back as a response. No error, no data. I have tried several different endpoints, all with the same result.

Example URL: https://graph.microsoft.com/1.0/reports/getSharePointSiteUsageDetail(period='D7')

The same issue occurs whether I'm using PowerShell Invoke-WebRequest, or the Graph Explorer site.

It can't be a permissions issue, as there is no error about permissions, and my account has the necessary 'Reports.Read.All' permission.

What is going on?

microsoft-graph-reports
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Danstan-MSFT avatar image
1 Vote"
Danstan-MSFT answered DavidPettitt-6572 commented

This endpoint returns CSV data that Graph Explorer trys to parse as a JSON thus resulting in the error. Even if the response was 200, Graph Explorer will fail and display 0 as the status code because it does not yet support CSV data in response.

You can test this on Postman which will handle and display the CSV data/content type. See screenshot below.

128971-reports-getsharepoint-usage-postman.png

There seems to be an issue with the fields Display Name and Site Url which is asked in this thread - getEmailActivityUserDetail(date=xxxx) was working but now is returning wrong values in UserPrincipal Identity, If you see the same thing, you can upvote the question.



· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you, that explains things perfectly!

I'll stick with using the beta endpoint until the 1.0 endpoint supports JSON output.

1 Vote 1 ·
Deva-MSFT avatar image
0 Votes"
Deva-MSFT answered DavidPettitt-6572 commented

What happens if you make the call in Microsoft Graph Explorer for the same user? Which HTTP code that you receive?

For delegated permissions to allow apps to read service usage reports on behalf of a user, the tenant administrator must have assigned the user the appropriate Azure AD limited administrator role. Refer the documentation.


· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

In Graph Explorer, I get no response. Just a red bar with a circled red X and the number 0, and then a ms value (different each time)

78907-2021-03-17-14-05-52-window.png


0 Votes 0 ·

Are you able to help with this?

There's another Graph API reports endpoint I need to query ( https://graph.microsoft.com/v1.0/reports/getMailboxUsageDetail(period='D7') ) and it is behaving the exact same way. No response, no error.

0 Votes 0 ·

I'm having the same thing happen when trying to query reports as well.

0 Votes 0 ·

If you're still having this problem @KenMarcum-6048 , please see my self-answer about using the beta endpoint with ?format=application/json at the end of the query. Sorry I didn't respond sooner, I didn't receive any notification that someone had added a comment.

@Deva-MSFT do you have an update on this? Is the 1.0 endpoint going to be fixed anytime soon?

0 Votes 0 ·
DavidPettitt-6572 avatar image
0 Votes"
DavidPettitt-6572 answered

Based on a different question here on the docs site (thanks for following this question, anonymous user, so that I could find your question) it appears that the /beta/ endpoint is functional, as long as ?$format=application/json is appended to the end of the query.

eg: https://graph.microsoft.com/beta/reports/getSharePointSiteUsageDetail(period='D7')?format=application/json

This is sufficient for now, but it sure would be nice if MS either fixed the 1.0 endpoint, or updated their documentation to mention that only the beta endpoint actually works.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.