Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live 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.
| User | Count |
|---|---|
| 21 | |
| 13 | |
| 8 | |
| 6 | |
| 4 |
| User | Count |
|---|---|
| 50 | |
| 42 | |
| 36 | |
| 16 | |
| 13 |