Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
SeSPowerBi
Frequent Visitor

Power BI REST API ExportTo Bad Request

Hello all,

My local solution is a Power BI ASP.NET web app registered in Azure AD using a client secret and client id (Azure service principal with a App Owns Data model). It preforms the Power BI REST API call "export=client.Reports.ExportToFileInGroup(workspaceid, reportid, exportRequest)" but it is catching a 400 Bad Request error.

 

When I tried testing https://docs.microsoft.com/en-us/rest/api/power-bi/reports/exporttofileingroup TryIt workspace it executed the request with a 200 response using the same groupid and reportid in our Azure account.

 

When I tried testing https://api.powerbi.com/v1.0/myorg/groups/:groupid/reports/:reportid/ExportTo from Postman with the Bearer token retrieved from https://login.microsoftonline.com/:tenant/oauth2/token for our Registered App (used in the local solution) within that Azure workspace, the error remains the same --Bad Request.

I have my header set to "Authorization: Bearer #######" and "Content-Type: application/json" to match TryIt, with the body set as "{"format": "PDF"}".

 

When I have taken the Bearer token from the TryIt workspace, and used it in the Postman call, the error persists.

 

Why is this error persisting? Has anyone delt with this call before and recieved a similar issue?

 @PowerBI @ExportTo

1 ACCEPTED SOLUTION

Hi @v-yiruan-msft

I had to use Fiddler to get more information on the error. It has to do with effective identities that needed to be provided in the body for RLS.

The links were helpful when determing the body for the request in Postman for RLS, however more research was required for how to apply it in our ASP.NET web app. 

This has been resolved now, thank you for your help.

View solution in original post

2 REPLIES 2
v-yiruan-msft
Community Support
Community Support

Hi @SeSPowerBi ,

Please review the solution in the following threads, hope they can help you.

REST API for Power BI, Reports - Export To File giving error

400 Bad Request Error when embedding report

Get Reports REST api not working - Showing 400 Bad Request (see message 5 from v-jiascu-msft)

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yiruan-msft

I had to use Fiddler to get more information on the error. It has to do with effective identities that needed to be provided in the body for RLS.

The links were helpful when determing the body for the request in Postman for RLS, however more research was required for how to apply it in our ASP.NET web app. 

This has been resolved now, thank you for your help.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.