Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

How to configure Power BI REST API as a data source

Good day,

 

I was recently searching for ways how to include the refresh history in a report and got introduced to the Power BI REST APIs. After playing with the "Try it" function on Microsoft's website I realised this is exactly what I need. I can build a URL using the group and dataset ID, which returns the refresh history as a JSON. 

 

Here is an example of what the URL looks like:

https://api.powerbi.com/v1.0/myorg/groups/group_id/datasets/dataset_id/refreshes

 

Is it possible to configure the API as a datasource in Power BI? I tried passing the URL as a Web source, but cannot authenticate with either my Windows or Organisational account.

 

Some forums suggested that I need an Azure app to facilitate the authentication. An app has been registered on the Azure portal and I have the application ID/ token ID/ secret value but I'm not sure how to use this to configure an API call as a data source.

 

Any help would be appreciated!

Regards

1 ACCEPTED SOLUTION
v-chenwuz-msft
Community Support
Community Support

Hi @Anonymous,

 

You can just use this code to get data from REST API in power query:

 

let
    Source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/groups/{group id}/datasets/{datasetid}", [Headers=[Authorization="Bearer ************"]])),
    value = Source[value],
    value1 = value{0}
in
    value1

 

result:

vchenwuzmsft_1-1639713413314.png

 

But you should first get the Authorization code. you can use Request URL ID to generate Access Token.

And you can refer this article to get data from REST API.

https://www.sqlshack.com/how-to-access-power-bi-rest-apis-programmatically/ 

 

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

3 REPLIES 3
v-chenwuz-msft
Community Support
Community Support

Hi @Anonymous,

 

You can just use this code to get data from REST API in power query:

 

let
    Source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/groups/{group id}/datasets/{datasetid}", [Headers=[Authorization="Bearer ************"]])),
    value = Source[value],
    value1 = value{0}
in
    value1

 

result:

vchenwuzmsft_1-1639713413314.png

 

But you should first get the Authorization code. you can use Request URL ID to generate Access Token.

And you can refer this article to get data from REST API.

https://www.sqlshack.com/how-to-access-power-bi-rest-apis-programmatically/ 

 

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Anonymous
Not applicable

Thank you @v-chenwuz-msft for your inputs.

 

I tried setting up the datasource as suggested and got the following message:

 

WJWest_1-1639724078344.png

 

Did I do something wrong in power query or is it not accepting the access token?

Hi @Anonymous ,

 

I get the same error message  just now, i edit the permission as anonymous .

vchenwuzmsft_0-1639727692912.png

 

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.