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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
dehoffmann
Frequent Visitor

Paginated Report REST API Export to PDF with PPU

Hello everyone,
I am currently going in circles with the usage of the API, PPU, and official documentation.
I have a paginated report with parameters that I want to export to pdf.
The process is going to be that I get a PDF report for each parameter (f.e: Projects A, B, and so on).

What I know/have:
The REST API needs the groupID and the reportID the report itself is in a workspace with PPU which I have.
The try me function always yields 403.
In a training video from MS, I saw that calling the API would result in a PDF.
I now am quite confused about the asynchronous process of rendering the pdf first.
- Is this a requirement for my purpose?

- And Is there a best practice to achieve this?

For me, it seems like there is some misleading information in the documentation itself with the sectioning. 
Some docs I read were part of general PowerBI but some were part of PowerBI Embedded(which I don't want).
F.e: From [1] REST API  I get the limitations here [2] 
or [3] Pooling is sectioned under Embedded.


I am aware of the 5-minute call limitation, does this mean I need to wait after each call or just the final export call?
So my understanding right now is that, if I have to pool first then I would have to wait 5 minutes to then check the status wait again, and then can export my PDF.


I don't know what I should try next and would appreciate any helpful advice.

Bests Dennis 

Links:
[1] https://learn.microsoft.com/en-us/rest/api/power-bi/reports/export-to-file
[2] https://learn.microsoft.com/en-us/power-bi/developer/embedded/export-to#considerations-and-limitatio...

[3] https://learn.microsoft.com/en-us/power-bi/developer/embedded/export-paginated-report#using-the-api 

1 ACCEPTED SOLUTION
dehoffmann
Frequent Visitor

Solved it myself.
Understanding the Pipeline and how to use which API in order with which permission.
For PDF Export we used Workato.

View solution in original post

4 REPLIES 4
dehoffmann
Frequent Visitor

Solved it myself.
Understanding the Pipeline and how to use which API in order with which permission.
For PDF Export we used Workato.

AmosHersch
Employee
Employee

Hi,

 

I think you need to first understand why you get the 403 error when using TryIt. Does the logged in user have access to the report? Does the response body contain more information for the error reason?

 

Regarding the 5 minutes limitation for the API, AFAIK it's for the first API which triggers the operation. It's not relevant for the API for polling the status, and for the API for retrieving the result. So you should be able to trigger an export operation once in 5 minutes.

Hi, thank you for your answer!

I am still not sure why I got the 403 and the body did not give me any hint, but I managed to comprehend the workflow.
In the beginning, it was not clear to me that I would have to do all steps one at a time.
I figured it out  but I am now stuck in the final API Call (Get File  of Export in Group) 
I get the correct response code 200 and my header says

cache-control: no-store, must-revalidate, no-cache
content-type: application/pdf
pragma: no-cache
requestid: xxx

but instead of an expected pdf download, I get a JSON Body UTF-8 gibberish. Is this the correct behavior of the API? Or is this something where I would have to use some other tools to extract the actual file?

Your code should save the file in the requested format, there's a sample code in "Step 3 - getting the file"  here Export Power BI embedded analytics paginated reports API - Power BI | Microsoft Learn

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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