The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
what is the code of rest api to get one dataflow enhanced compute engine details. And I have to get details of enhanced compute engine of all the dataflows across the workspace. is there a way to do this.
Thanks
Solved! Go to Solution.
Hi @SakethPatchava , Thank you for reaching out to the Microsoft Community Forum.
To retrieve the Enhanced Compute Engine details for a specific dataflow and for all dataflows in a Power BI workspace using the Power BI REST API, follow these steps:
Example:
import requests
workspace_id = "YOUR_WORKSPACE_ID"
access_token = "YOUR_ACCESS_TOKEN"
dataflows_url = f"https://api.powerbi.com/v1.0/myorg/groups/{workspace_id}/dataflows"
headers = {
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json"
}
response = requests.get(dataflows_url, headers=headers)
dataflows = response.json().get('value', [])
results = []
for dataflow in dataflows:
dataflow_id = dataflow['id']
details_url = f"https://api.powerbi.com/v1.0/myorg/groups/{workspace_id}/dataflows/{dataflow_id}"
details_response = requests.get(details_url, headers=headers)
if details_response.status_code == 200:
details = details_response.json()
results.append({
"dataflow_id": dataflow_id,
"name": dataflow["name"],
"enhancedComputeEngine": details.get("enhancedComputeEngine")
})
else:
print(f"Failed to get details for dataflow {dataflow_id}")
for res in results:
print(f"Dataflow: {res['name']} (ID: {res['dataflow_id']}) → Enhanced Compute Engine: {res['enhancedComputeEngine']}")
POST https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token.
Pass the token in the header for all API calls:
Authorization: Bearer {access_token}
Please refer below documentation for more details:
If this helped solve the issue, please consider marking it 'Accept as Solution' so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.
Hi @SakethPatchava , Thank you for reaching out to the Microsoft Community Forum.
When you make a call to the Power BI REST API, Microsoft requires you to authenticate first. The Bearer token is like a digital key that proves your identity. You include this token in the Authorization header of each API call.
To get the Bearer Token, one needs to register an Application in Azure Active Directory, get necessary credentials, create a Client Secret, grant API Permissions and Once your app is registered and permissions are granted, you can generate a token by making a POST request to the OAuth 2.0 token endpoint. OAuth 2.0 Token Endpoint: POST https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token
When making API calls to Power BI, you need to include specific headers in your request. The header contains metadata about the request, such as the authentication token, the content type, and sometimes additional configuration details. Example: Content-Type: application/x-www-form-urlencoded
Example of Python Code to Get a Token:
import requests
tenant_id = "YOUR_TENANT_ID"
client_id = "YOUR_CLIENT_ID"
client_secret = "YOUR_CLIENT_SECRET"
token_url = f"https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token"
data = {
"grant_type": "client_credentials",
"client_id": client_id,
"client_secret": client_secret,
"scope": "https://api.powerbi.com/.default"
}
response = requests.post(token_url, data=data)
if response.status_code == 200:
access_token = response.json().get("access_token")
print("Access Token:", access_token)
else:
print("Failed to retrieve token:", response.text)
Once you have the token, you include it in the request header for all API calls. Example of Calling the Power BI REST API with the Token:
headers = {
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json"
}
workspace_id = "YOUR_WORKSPACE_ID"
api_url = f"https://api.powerbi.com/v1.0/myorg/groups/{workspace_id}/dataflows"
response = requests.get(api_url, headers=headers)
if response.status_code == 200:
print("Dataflows:", response.json())
else:
print("Failed to retrieve dataflows:", response.text)
In the Azure Portal, go to your Azure Portal -> Azure Active Directory -> App Registration -> Select your app -> API Permissions -> Add a Permission -> Power BI Service -> Select Dataflow.Read.All, Dataflow.ReadWrite.All -> Add Permissions -> Grant Admin Consent.
If this helped solve the issue, please consider marking it 'Accept as Solution' so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.
Hi @SakethPatchava , We are closing this thread as we haven't heard from you in a while, according to our follow-up policy. If you have any more questions, please start a new thread on the Microsoft Fabric Community Forum. We will be happy to assist you! Thank you for being part of the community!
Hi @SakethPatchava , Please let us know if your issue is solved. If it is, consider marking the answer that helped 'Accept as Solution', so others with similar queries can find it easily. If not, please share the details.
Thank you.
Hi @SakethPatchava , Please let us know if your issue is solved. If it is, consider marking the answer that helped 'Accept as Solution', so others with similar queries can find it easily. If not, please share the details.
Thank you.
No it is still not clear for me about the solution.
Hi @SakethPatchava , Thank you for reaching out to the Microsoft Community Forum.
To retrieve the Enhanced Compute Engine details for a specific dataflow and for all dataflows in a Power BI workspace using the Power BI REST API, follow these steps:
Example:
import requests
workspace_id = "YOUR_WORKSPACE_ID"
access_token = "YOUR_ACCESS_TOKEN"
dataflows_url = f"https://api.powerbi.com/v1.0/myorg/groups/{workspace_id}/dataflows"
headers = {
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json"
}
response = requests.get(dataflows_url, headers=headers)
dataflows = response.json().get('value', [])
results = []
for dataflow in dataflows:
dataflow_id = dataflow['id']
details_url = f"https://api.powerbi.com/v1.0/myorg/groups/{workspace_id}/dataflows/{dataflow_id}"
details_response = requests.get(details_url, headers=headers)
if details_response.status_code == 200:
details = details_response.json()
results.append({
"dataflow_id": dataflow_id,
"name": dataflow["name"],
"enhancedComputeEngine": details.get("enhancedComputeEngine")
})
else:
print(f"Failed to get details for dataflow {dataflow_id}")
for res in results:
print(f"Dataflow: {res['name']} (ID: {res['dataflow_id']}) → Enhanced Compute Engine: {res['enhancedComputeEngine']}")
POST https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token.
Pass the token in the header for all API calls:
Authorization: Bearer {access_token}
Please refer below documentation for more details:
If this helped solve the issue, please consider marking it 'Accept as Solution' so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.
Can you explain 4th point and 5th point in detail.
Thanks
Hi @SakethPatchava , Thank you for reaching out to the Microsoft Community Forum.
When you make a call to the Power BI REST API, Microsoft requires you to authenticate first. The Bearer token is like a digital key that proves your identity. You include this token in the Authorization header of each API call.
To get the Bearer Token, one needs to register an Application in Azure Active Directory, get necessary credentials, create a Client Secret, grant API Permissions and Once your app is registered and permissions are granted, you can generate a token by making a POST request to the OAuth 2.0 token endpoint. OAuth 2.0 Token Endpoint: POST https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token
When making API calls to Power BI, you need to include specific headers in your request. The header contains metadata about the request, such as the authentication token, the content type, and sometimes additional configuration details. Example: Content-Type: application/x-www-form-urlencoded
Example of Python Code to Get a Token:
import requests
tenant_id = "YOUR_TENANT_ID"
client_id = "YOUR_CLIENT_ID"
client_secret = "YOUR_CLIENT_SECRET"
token_url = f"https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token"
data = {
"grant_type": "client_credentials",
"client_id": client_id,
"client_secret": client_secret,
"scope": "https://api.powerbi.com/.default"
}
response = requests.post(token_url, data=data)
if response.status_code == 200:
access_token = response.json().get("access_token")
print("Access Token:", access_token)
else:
print("Failed to retrieve token:", response.text)
Once you have the token, you include it in the request header for all API calls. Example of Calling the Power BI REST API with the Token:
headers = {
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json"
}
workspace_id = "YOUR_WORKSPACE_ID"
api_url = f"https://api.powerbi.com/v1.0/myorg/groups/{workspace_id}/dataflows"
response = requests.get(api_url, headers=headers)
if response.status_code == 200:
print("Dataflows:", response.json())
else:
print("Failed to retrieve dataflows:", response.text)
In the Azure Portal, go to your Azure Portal -> Azure Active Directory -> App Registration -> Select your app -> API Permissions -> Add a Permission -> Power BI Service -> Select Dataflow.Read.All, Dataflow.ReadWrite.All -> Add Permissions -> Grant Admin Consent.
If this helped solve the issue, please consider marking it 'Accept as Solution' so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.
Hi @SakethPatchava - Below resources should provide you with the necessary information to manage and retrieve details about the Enhanced Compute Engine for your dataflows using the Power BI REST API.
Premium features of dataflows - Power BI | Microsoft Learn
Dataflows - REST API (Power BI Power BI REST APIs) | Microsoft Learn
What is a Dataflow Transaction in Power BI | Orchestra
Hope this helps.
Proud to be a Super User! | |
User | Count |
---|---|
37 | |
14 | |
13 | |
12 | |
8 |
User | Count |
---|---|
49 | |
43 | |
23 | |
19 | |
18 |