This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
Hi All,
I am trying to execute the "ExecuteQueries" REST API method on a dataset using Python programming, but I am not sure where i need to write body.
I gone through the microsoft documentation for ExecuteQueries REST API method
there it's mentioned to provide body in json format to get desired results
but i don't have any clue how i can pass this body to the executequeries API
Can you plese help on this if possible
thanks in advance
Solved! Go to Solution.
Hi Abhinary_Roze. Yes the doc specify a body for the post. You can build a dict at python and then convert it as the parameter of the request. Check this example using requests and json libraries:
import requests
import json
url= "https://api.powerbi.com/v1.0/myorg/groups/{}/datasets/{}/executeQueries".format(workspace_id, dataset_id)
body = {
"queries": [{"query": query}],
"serializerSettings": {"includeNulls": "true"}
}
res = requests.post(url, data = json.dumps(body), headers = headers)
The requests.post will receive the url, body and headers (here you must write the bearer). You can convert your python dictionary (body variable) with json.dumps.
If you feel this all is too much you can use a Power Bi Rest API python library like SimplePBI. In there you can just import library, create token, create dataset class and make the request.
https://pypi.org/project/SimplePBI/
I hope that helps,
Happy to help!
Hi Abhinary_Roze. Yes the doc specify a body for the post. You can build a dict at python and then convert it as the parameter of the request. Check this example using requests and json libraries:
import requests
import json
url= "https://api.powerbi.com/v1.0/myorg/groups/{}/datasets/{}/executeQueries".format(workspace_id, dataset_id)
body = {
"queries": [{"query": query}],
"serializerSettings": {"includeNulls": "true"}
}
res = requests.post(url, data = json.dumps(body), headers = headers)
The requests.post will receive the url, body and headers (here you must write the bearer). You can convert your python dictionary (body variable) with json.dumps.
If you feel this all is too much you can use a Power Bi Rest API python library like SimplePBI. In there you can just import library, create token, create dataset class and make the request.
https://pypi.org/project/SimplePBI/
I hope that helps,
Happy to help!
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |