cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Power BI Rest API continuation token is corrupted

Hi,
When running the Get Activity Events API Call, it returns a few activities and a continuation token. When trying to use the token to contionue the call, i get the following error: 

 

{

  "error": {

    "code""InvalidRequest",

    "message""Looks like that continuation token is corrupted. Replace it with the same continuation token that was sent back in the previous API response, and try again"

  }
}

I get this error when i have single quotations around the token. if i do not have any quotations i get the following error:

{
  "error": {
    "code": "BadRequest",
    "message": "Bad Request",
    "details": [
      {
        "message": "Expected literal type token but found token 'LDIwMjAtMDQtMDZUMDA6MDA6MDEsMjAyMC0wNC0wNlQyMzo1OTo1OSwxLCw'.",
        "target": "continuationToken"
      }
    ]
  }
}



1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

Re: Power BI Rest API continuation token is corrupted

Hi @liljath 

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.

View solution in original post

4 REPLIES 4
Highlighted
New Member

Re: Power BI Rest API continuation token is corrupted

Hi,

 

Did you manage to get this fixed?

I have tried using the token but keep getting the same errors as you. I have put single quotes around the token, double quotes as well.

 

Cheers,

liljath

Highlighted
Frequent Visitor

Re: Power BI Rest API continuation token is corrupted

Hi @liljath 

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.

View solution in original post

Highlighted
New Member

Re: Power BI Rest API continuation token is corrupted

Hi @oliversvane ,

 

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

Highlighted
Frequent Visitor

Re: Power BI Rest API continuation token is corrupted

Hi @liljath 

 

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')

 

Helpful resources

Announcements
Meet the 2020 Season 2 Power BI Super Users!

Meet the 2020 Season 2 Power BI Super Users!

Find out who's part of the program this season, and welcome the new Super Users.

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

July 2020 Community Highlights

July 2020 Community Highlights

Learn about the exciting things that happened in July.

Featured Data Story of The Month

Featured Data Story of The Month

All Data Stories Gallery contributions are reviewed for each month. We select a contribution and feature the community member the following month.

Power BI Dev Camp - Developing with .NET Core

Power BI Dev Camp - Developing with .NET Core

Learn how to develop custom web applications for Power BI using .NET Core 3.1 and .NET 5.