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.
I am working on a python script to export reports from a workspace using Power BI Rest API:
headers={"Authorization": f"Bearer{token}"}
url = https://api.powerbi.com/v1.0/myorg/groups/{groupId}/reports/{reportId}/Export
response = requests.get(url, headers=headers)
with open(f"{folder_path}/{file_name}.pbix","wb") as report:
report.write(io.BytesIO(response.content).getbuffer())
It's working for files less than 100mb but I'm getting a 500 internal server error 500 for files greater than 100mb
I've also tried with the workaround mentioned here: https://learn.microsoft.com/en-us/rest/api/power-bi/reports/export-report-in-group
by using GET https://api.powerbi.com/v1.0/myorg/groups/{groupId}/reports/{reportId}/Export?preferClientRouting=tr... and it is giving me "403 client error: forbidden for url: https://api.powerbi.com/v1.0/myorg/groups/{groupId}/reports/{reportId}/Export"
The logic I have used to get the token
url = https://login.microsoftonline.com/<tenant>/oauth2/v2.0/token
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload,headers=header)
token = response.json()["access_token"]
In payload I have given the client ID, secret and the scope.
How can I resolve this issue?
Thanks in advance!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.