Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
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
Solved! Go to Solution.
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:
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.
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:
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.
Thank you @v-chenwuz-msft for your inputs.
I tried setting up the datasource as suggested and got the following message:
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 .
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.
Ask questions in Eventhouse and KQL, Eventstream, and Reflex.
Check out the May 2024 Power BI update to learn about new features.