cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Awaiskhan
New Member

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

Hello!

While trying to test REST Api for export to file, i am facing the below issue#403 for all types of file. I want to use the export file behind a button in my power bi report to export the pdf file. 

https://docs.microsoft.com/en-us/rest/api/power-bi/reports/exporttofile

 

Body

JSONCopy
 
{
  "error": {
    "code": "InvalidRequest",
    "message": "Report requested for export is not on dedicated capacity"
  }
}

 

1 ACCEPTED SOLUTION

After reading hundreds of tutorials, finally I get a solution that at least is working fine for me. The blog that helped me the most was:

 

Post Calling The Power BI Export API From Power Automate, Part 2: Creating A Flow That Exports A Paginate...

in https://blog.crossjoin.co.uk/

 

The steps for me were:

  • Azure Power bi resource name embeeded app must be running BEFORE you login into the "try it" button of the API documentation page. and then (copy pasted from the refered blog). I was pausing the app while finding the solution to stop the billing counter.
  • Export To File In Group must be called first, to start the process of exporting either a Power BI report or a paginated report to a file. Exporting may take some time, though, so the exported file doesn’t get returned at this point. In the headers of the response there is a retry-after value in seconds telling you how long you must wait initially, before…
  • …calling Get Export To File Status In Group to find out whether the export is ready or not. If it isn’t ready you again need to wait the number of seconds specified in the retry-after header before checking the status again. If it is ready, you can then…
  • …call Get File Of Export To File In Group to download the export file.

 

Hope that works for you aswell. 

 

 

 

View solution in original post

7 REPLIES 7
Greg_Deckler
Super User
Super User

Well, the error you are getting seems to indicate that you need Premium or Embedded. What kind of license do you have?

 

You could check the Issues forum here:

https://community.powerbi.com/t5/Issues/idb-p/Issues

And if it is not there, then you could post it.

If you have Pro account you could try to open a support ticket. If you have a Pro account it is free. Go to https://support.powerbi.com. Scroll down and click "CREATE SUPPORT TICKET".


@ me in replies or I'll lose your thread!!!
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Learn Power BI 2nd Edition

I'm facing same error. I tried to get the correct licenses (trial mode) so now the report is in a group with premium capacity activated.

I also give a PowerBi Pro license to the user that is testing the API. The workgroup now shows the diamond icon on the right side of its name, so I guess it is correctly setted up.

 

But the thing is I'm getting the same error message. Any Idea of what I'm doing wrong? what else should I check?

 

Really thanks in advance!

I'm also getting the same error.  I am also using A1 capacity.

 

What else should I be considering! Are there specific changes I need to make to the workspace or the power bi capacity, should I be using a service principal. 

 

Any assistance appreciated.

After reading hundreds of tutorials, finally I get a solution that at least is working fine for me. The blog that helped me the most was:

 

Post Calling The Power BI Export API From Power Automate, Part 2: Creating A Flow That Exports A Paginate...

in https://blog.crossjoin.co.uk/

 

The steps for me were:

  • Azure Power bi resource name embeeded app must be running BEFORE you login into the "try it" button of the API documentation page. and then (copy pasted from the refered blog). I was pausing the app while finding the solution to stop the billing counter.
  • Export To File In Group must be called first, to start the process of exporting either a Power BI report or a paginated report to a file. Exporting may take some time, though, so the exported file doesn’t get returned at this point. In the headers of the response there is a retry-after value in seconds telling you how long you must wait initially, before…
  • …calling Get Export To File Status In Group to find out whether the export is ready or not. If it isn’t ready you again need to wait the number of seconds specified in the retry-after header before checking the status again. If it is ready, you can then…
  • …call Get File Of Export To File In Group to download the export file.

 

Hope that works for you aswell. 

 

 

 

@riguberto 

I have done the similar steps and used the 3 REST APIs you mentioned in my Flow to get the report PDF. Its working all fine.

 

As a next step, I want to export only certain pages of my report in PDF.

Have you tried that or have any leads on how it can be done?

 

Regards

@vmakhija , can you share your code, i am also trying to download report as file but getting error. 

I have followed microsoft documentation , not working for me

 

I am also getting same error when using new REST API released from Microsoft
Invoke-RestMethod : {"error":{"code":"InvalidRequest","message":"Report requested for export is not on dedicated capacity"}}
At line:1 char:1
+ Invoke-RestMethod -Uri $uri2 -Headers $auth_header -Method GET -Body ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.