Automate Report-PDF Download
A showcase on how to automatically download PDFs for completed reports with our API
- Event Trigger: When a report is completed, our software can make use of webhooks to trigger something. In this case, our software uses report-complete webhook to trigger a script that takes care of the generation of a PDF and exports it using our API.
- Start the PDF generation with the POST request to /reports/{report_id}/generate-pdf endpoint. This request includes the necessary data, such as the report ID, and export parameters. Our backend starts to generate the PDF file. The returned payload includes the
reportPdfId
, simply calledid
in the payload, which you'll need for the next steps. - Status Monitoring: After initiating the PDF generation, you can track the status of the report PDF generation by using the /reports-pdf/{reportPdfId} endpoint. Periodically check the status for a
completed
. To be safe regarding rate limiting, have those checks delayed for 1-2 seconds. If the status changes tocompleted
, proceed to the next step. Otherwise, keep checking. The average PDF takes 5-10 seconds to generate. Generating multiple PDFs (e.g. multiple languages) extends the time it takes. - PDF Retrieval: Once the report PDF generation status is
completed
, make a GET request to /reports-pdf/{reportPdfId}/file.pdf to retrieve the PDF file. - PDF Storage: The downloaded PDF report can be stored in a designated location, making it accessible within your systems.
Updated 3 months ago
What’s Next
To get started, you will need a webhook to trigger this process.