Forum Discussion
Power BI Rest API continuation token is corrupted
- Anonymous6 years ago
Hi Anonymous
Yes, yous should not use the continuationToken, but the continuationUri, and use it to make a new get request.
The documentation for this API is poor and outdated, unfortunately.
Let me know if you need further assistance.
Hi Anonymous ,
Thank you for this 🙂 it's been driving me crazy lol
Do you know if it possible to use the powerbiclient from the package Microsoft.PowerBI.Api?
I am using pbiClient.Admin.GetActivityEvents(startdate, enddate) to get the first call but when I put the continuationtoken in there it just doesn't work.
I was thinking maybe something like powerbiclient.httpclient ... but have tried this with a 403 result.
Do you call the api with this client or a normal httpclient?
cheers,
liljath
Hi Anonymous
I am currently using Power Automate to pull the data one a day. You can read more about the general idea here:
https://medium.com/@Konstantinos_Ioannou/refresh-powerbi-dataset-with-microsoft-flow-73836c727c33
It is an old article showing you how to refresh a dataset uding Power Automate (this article is from before it was possible with a simple connector)
If you are using Powershell you can use the PBI Cmdlets (read more here). Once that is installed you can run requests from Powershell. Here is an example, where the logs are saved in .json files for each individual day:
Login-PowerBI
$date = [datetime]'07/10/2020'
$array =
do {
$date.ToString('yyyy-MM-dd')
$date2 =(Get-Date $date -Format 'yyyy-MM-dd')
$begindate=-join($date2,'T00:00:00')
$enddate =-join($date2,'T23:59:59')
$paths =-join('C:\audit\',$date2,'.json')
$activities = Get-PowerBIActivityEvent -StartDateTime $begindate -EndDateTime $enddate | Out-File $paths
$date = $date.AddDays(1)
}
until ($date -gt [datetime]'07/14/2020')