Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
All,
I have registered my application and got the client id. Note, I have used 'Native' option while registration.
My requirement is to push data from python script.
I have tried with ADOL, it seems fine, but i tried with 'request' package & called PowerBI's API
to push the data into my workspace.
from datetime import datetime
from random import randint
import time
import requests
import json
with open('sample.json') as json_file:
json_data = json.load(json_file)
print(json_data)
url = 'https://login.microsoftonline.com/common/oauth2/token'
data = {
'grant_type': 'password',
'scope': 'https://api.powerbi.com',
'resource': 'https://analysis.windows.net/powerbi/api',
'client_id': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'username': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'password': 'xxxxxxx'
}
r = requests.post(url, data=data)
access_token = r.json().get('access_token')
print(access_token)
header = {'Authorization': 'Bearer {}'.format(access_token), 'Content-Type': 'application/json', }
api = requests.put('https://api.powerbi.com/v1.0/myorg/datasets?defaultRetentionPolicy=basicFIFO', headers=header, json=json_data)
print("API Result: {}\n{}\n".format(api.status_code, api.text))
# r = requests.post('https://api.PowerBI.com/v1.0/myorg/datasets', json.dumps(data), verify = False)
Error Message:
API Result: 404
{
"error":{
"code":"","message":"No HTTP resource was found that matches the request URI 'http://api.powerbi.com/v1.0/myorg/datasets?defaultRetentionPolicy=basicFIFO'."
}
}
I just used the same json body file given in the powerbi reference site.
I created the dataset by using below the link successfully.
https://docs.microsoft.com/en-us/rest/api/power-bi/pushdatasets/datasets_postdataset#code-try-0
Note: I am able to view the list of Datasets by using the below API.
api = requests.get('https://api.powerbi.com/v1.0/myorg/datasets', headers=header)
print("API Result: {}\n{}\n".format(api.status_code, api.text))
this API is working, but the POST method to push the dataset is not working. How? what is the missing piece here?
any help would be really appreciable!
any inputs ?
Team,
Please let me know do i need to get in touch with some support team for this.
any thoughts?
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
9 | |
7 | |
2 | |
2 | |
2 |
User | Count |
---|---|
6 | |
5 | |
4 | |
4 | |
4 |