Friday, July 31, 2020

Using the Power BI REST API as Admin

Last month when I was trying to follow the excellent video on Building a Power BI Admin View by Parker Stevens ( b | @PowerBIElite | YouTube).



However, I ran into a few things that I'd like to dedicate this quick post on.

 

Connecting to the API

The first thing was I ran into the following error:



Turns out it had to do with me connecting to the REST API in an earlier session, but with Windows authentication. 


So after clearing the permissions I could login fine after selecting Anonymous:



 

Exceeded Amount of Allowed Requests

Probably because I was not as fast as Parker creating the report, I ran into the following problem :-)

 

Power BI Desktop wil NOT return an error message, instead it will just keep spinning.. The Try It button on the REST API Documentation site will however return a 429 Response code, saying you have exceeded the amount of allowed requests, and I have to wait (approximately 😀) 1256 seconds.



Refreshable Access Token

In Part 2: Obtaining a Refreshable Access Token Parker explains how to get past the point of entering your Bearer token everytime it expires :-)

 

Limit The Number of API Calls

Another important point was made by Marc Lelijveld ( b | @MarcLelijveld), he suggests to use the $expand parameter of the GetGroupsAsAdmin function. That way you don't have to query the API every time per dataset/dataflow/etc.


 

You can check a few examples of the use of $expand at the documentation of the Admin- Groups GetGroupsAsAdmin page.

 

Recap

I hope reading this will help you in better setting up management of your Power BI environment.


No comments:

Post a Comment

Thanks for taking the time to provide feedback!

Cheers,
Nicky

Featured Post

My DataGrillen Adventure: Speaking, Connecting, and New Friendships

I just got back from an incredible trip to DataGrillen, and I can’t wait to share my experiences with you. If you haven’t heard of it,  Data...