Forum Discussion
Power BI Admin API Report Refresh Issues
ibarrau Thanks for your inputs. Yes I have already tried that method. But no luck 😞
Then I think the Power Query code of the post it's an approach. Not every develop at Desktop can be on the production environment. What we actually do for activity logs is exporting with a Python library SimplePBI. Then connect PowerBi to that data.
If you have a requirement for doing it over power query then it might be deep dive research on how to create a code that works on service. Otherwise you can try approaches like python.
I hope that helps,
- itsmebvk3 years ago
Continued Contributor
ibarrau agree with you. Can you please provide any blog or reference document which talks about this implementation using python .
Thanks in advance.
- ibarrau3 years ago
Super User
I think the doc is pretty straight forward.
https://github.com/ladataweb/SimplePBI
You can check how to get the token and use admin requests right there. Getting the activity logs it's an admin request. If you check the example using admin then just look for the correct method for the admin object "a" and capture the result in a variable. I think you can even convert the result from json to pandas (a library for dataframes) in the parameters. It gets a single day or the last 30 in a single line. It handles pagination.
I guess it would be like this:
from simplepbi import token from simplepbi import admin TENANT_ID = "XXXXXX" power_bi_client_id = 'XXXXXX' # Regular Login power_bi_username = '[email protected]' power_bi_password = 'XXXXXX' tok = token.Token(tenant_id, app_client_id, username, password, None, use_service_principal=False) # Service Principal Login power_bi_secret = 'XXXXXX' tok = token.Token(tenant_id, app_client_id, None, None, app_secret_key, use_service_principal=True) # Create admin object ad = admin.Admin(tok.token) # Last day pandas response frame_result = ad. get_activity_events_preview(activity_date="2023-05-03", return_pandas=True) # Last 30 days pandas response result = ad.get_activity_events_last_30_days_preview()I hope that helps,