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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

How to get refresh history of dataset using powerbi REST API ?

 I am new to Power BI and still learning about REST API.  I have written powershell script to get the refresh history of a dataset. The script ran but with the output “@odata.context”.  What does the “value” and “id” indicates ? From where can I get refresh history details?  Any suggestion to this matter is highly appreciated.

 

2.png

 

Thanks,

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous,

 

as you can see here the endpoint returns an ODataResponse with the list of refreshes. In the Value field that it's returned you will get an array of Refresh objects which is the Power BI refresh history entry. 

What you have to do is something like this:

$refreshesList = Invoke-RestMethod (as you already did)  
Iterate in $refreshesList.Value and get the properties you need, like $refreshesList.Value[i].endTime, etc.

 

Of course you can do more things when you invoke an odata endpoint, like filtering and selecting fields (using $filter or $select in the query string of the url that you use) 

 

Hope this helps.

 

Regards,

 

Thanos 

View solution in original post

5 REPLIES 5
AnilKumar
Helper II
Helper II

Hi,

 

We want  to try to log the refresh history to external DB Tables. could you share your Powershell logic ?

 

 

Thnaks & Regards,

Vishnu Priya

 

 

Anonymous
Not applicable

Hi @AnilKumar ,

 

You can refer the below link to understand the exract of refresh history details. 

 

https://github.com/microsoft/powerbi-powershell/blob/master/examples/Export-RefreshHistory.ps1

 

I had written a script which exported the data into csv files.

 

Best Regards,

ankbaner

Anonymous
Not applicable

Hi @Anonymous,

 

as you can see here the endpoint returns an ODataResponse with the list of refreshes. In the Value field that it's returned you will get an array of Refresh objects which is the Power BI refresh history entry. 

What you have to do is something like this:

$refreshesList = Invoke-RestMethod (as you already did)  
Iterate in $refreshesList.Value and get the properties you need, like $refreshesList.Value[i].endTime, etc.

 

Of course you can do more things when you invoke an odata endpoint, like filtering and selecting fields (using $filter or $select in the query string of the url that you use) 

 

Hope this helps.

 

Regards,

 

Thanos 

Anonymous
Not applicable

Hi @Anonymous,

 

Thank you for the reply. $refreshList.Value worked and I get refresh history list of dataset. But is there any possibility to export the list into  a PBI report ? If you can point me to link that would be really helpful.

 

 

Regards,

Ankita

 

Anonymous
Not applicable

Hi @Anonymous,
This is a different question than the original one.
An easy way would be to create a text file from your powershell script and use powerbi desktop to connect to this file and show the Dara.
There are also other ways but it's out of scope.

Hope it helps.

Regards
Thanos
Ps: please mark my answer as solution if it helped you solve your issue. In this way we help other users too.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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