Guides

Automate Report-PDF Download

A showcase on how to automatically download PDFs for completed reports with our API

  1. 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.
  2. 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 thereportPdfId, simply called id in the payload, which you'll need for the next steps.
  3. 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 to completed, 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.
  4. 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.
  5. PDF Storage: The downloaded PDF report can be stored in a designated location, making it accessible within your systems.

What’s Next

To get started, you will need a webhook to trigger this process.