Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
I an unable to get visual ID from the pages :
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 12 00:13:23 2023
@author: MAnish Chauhan | +91-(9774083186) |
"""
# Importing Pacakages
import requests
import msal
import pprint
# Defining the variables
# app id - Client ID from Azure application
app_id='-'
# Tenant Id - ID from the azure application
tenant_id = '-'
# auth_url - Default Value with dynamic tenant
auth_url = 'https://login.microsoftonline.com/' + tenant_id
# scope - default value
scope = ['https://analysis.windows.net/powerbi/api/.default']
# Azure application secret code value
client_secret='-'
# User credentials
username = '-' # Replace with your username
password = '-' # Replace with your password
# Getting the access token using username and password
app = msal.PublicClientApplication(app_id, authority=auth_url)
result = app.acquire_token_by_username_password(username, password, scopes=scope)
# Checkpoint
#print(response)
access_token=response.get('access_token')
#print(access_token)
report_id='b31696d7-5e7d-4a3e-80b8-f96d633da8db'
workspace_id='*****************************************'
#endpoint- API endpoint for the service which needs to be accesssed
endpoint="https://api.powerbi.com/v1.0/myorg/groups/*********************/reports/*******************/pages/Re..."
#endpoint= 'https://api.powerbi.com/v1.0/myorg/groups/'+Workspace_ID+'/dashboards'
#endpoint= 'https://api.powerbi.com/v1.0/myorg/groups/'+Workspace_ID+'/datasets/cab13d40-d7df-4296-8d00-8affd86b...'
#Headers for authorization
The code works fine until given end point , however I am not able to get endpoint which gives me the visual ID
headers={
'Authorization': 'Bearer '+access_token
}
response_dataset=requests.get(endpoint, headers=headers)
#print(response_dataset)
#pprint.pprint(response_dataset.json())
print(response_dataset.status_code)
Use the embedded playground to retrieve the visual ID.
Once you have it, what do you plan to do with it?
Thanks for suggesting , i will try that. Post getting the visual id , plan is to somehow export data of the visual through python.
You can use the "Export to PNG" API call.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.