cancel
Showing results for 
Search instead for 
Did you mean: 
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 

View solution in original post

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

November Power BI Update 768x460.png

Check it Out!

Click here to read more about the November 2021 Updates!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.