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

Get Activity Events API doesn't return activities when activities exist

Admin API - Get Activity Events (GET https://api.powerbi.com/v1.0/myorg/admin/activityevents) doesn't return data when activity data exists in the audit log.

 

When using "Admin - Get Activity Events" API it doesn't return data for dates in past 90 days 

When using "Get-PowerBIActivityEvents" in Powershell results are returned correctly

 

Example (The same user has been used and is a Power BI Administrator):

 

Doesn't return data via API (https://docs.microsoft.com/en-us/rest/api/power-bi/admin/getactivityevents#code-try-0

PBIActivityEvents from API #1 (20200115).JPGPBIActivityEvents from API #2 (20200115).JPG

 

Return data via Powershell for same period:

PBIActivityEvents from PS #1 (20200115).JPG

 

 

 

The API has the same issue that was logged for the Powershell Activity Events which has been subsequently fixed : https://github.com/microsoft/powerbi-powershell/issues/191 

1 REPLY 1
dazcuk46 Frequent Visitor
Frequent Visitor

Re: Get Activity Events API doesn't return activities when activities exist

After logging with MS Premier Support their investigation found that currently the RestAPI playground doesn’t support the token continuation logic. 

 

They pointed to blog post that introduced the activity log API: 

 

“As a general rule, regardless of the number of entries returned, if the results include a continuation token, make sure you call the API again with that token to retrieve the remaining data, until a continuation token is no longer returned. It can happen that a call even returns a continuation token without any event entries. But don’t let the absence of activity events distract you. Just keep calling back with that continuation token. Here is how you can code against the continuation token that is returned in the response

 

Source: https://powerbi.microsoft.com/en-us/blog/the-power-bi-activity-log-makes-it-easy-to-download-activit...

 

 

As the playground API didn't work as first assumed we have subsequently implemented using continuation tokens within SSIS to retrieve data from the API.

 

Some observations of how the API works - during testing we used Fiddler and the results were interesting - it appears for the hour periods you are calling it will call as many continuation tokens.  So...

For a 24 hour period (the max the API supports) it will call the API 24 times

For 8am - 8pm it would call 12 times

For 8am to 9:10am it would be called twice

 

This makes sense why an array returned can be empty and you have to continue calling even though no data is returned it appears to be querying the audit logs for each hour within the parameters passed 

Helpful resources

Announcements
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors
Top Kudoed Authors