DNA report PDFs can be generated via the report-job endpoints, as described in the previous section.
To generate PDFs for other pages, like for your lab results, you can use the pdf-job endpoints.
Note: pdf-job also supports generating PDFs for already generated DNA reports.
PDF Type
One extra field that PDF jobs have that report jobs don't have is the pdf_type field. Possible values for now are:
- lab
- report
For report jobs, type is always implied as "report", while for PDF jobs, you need to explicitly specify for each request.
Creating a PDF Job
Below is an example request to generate a PDF for the lab results page:
POST /b2b-integrations/pdf-job/
{
"profile_id": "54db4946-a246-4b04-abba-00c83793592a",
"pdf_type": "lab",
"pdf_config": {
"result_inputs": "latest_results",
"lab_results_type": "out_of_optimal"
}
}
The pdf_config supports all of the same configurations as before. See PDF Configurations for details.
While generating PDFs for labs, you can optionally pass the results object inside pdf_config as given here , or you can directly pass the result_ids as a list. If you don't pass any, the PDF would contain all of your lab results by default.
You can also generate a PDF for a generated DNA report:
POST /b2b-integrations/pdf-job/
{
"profile_id": "a9f300f6-7f2c-449e-8777-daa930f89ba7",
"pdf_type": "report",
"pdf_config": {
"report_id": "ff4f5b07-89fe-4a02-a151-60ff0de8b721"
}
}
Here, you must pass the report_id in the pdf_config.
Retrieving the PDF
Retrieving is exactly same as for report jobs. You will be returned the URL to download the PDF in the pdf_url field, as received from the report_job
GET /pdf-job/e213af9e-f0e1-4cd1-9daa-f12525d70518/
Response:
{
"id": "e213af9e-f0e1-4cd1-9daa-f12525d70518",
"user_id": "c98ed9db-9238-4958-8072-e8c323e3d4ad",
"status": "pdf_generated",
"handling_failed": false,
"created_at": "2024-03-13T17:37:43.744958Z",
"finished_at": "2024-03-13T17:38:23.277461Z",
"error": "",
"pdf_url": "https\://sd-platform-prod-userdatas3bucke...",
"profile_id": "54db4946-a246-4b04-abba-00c83793592a",
"pdf_file_name": "",
"pdf_config": {},
"pdf_type": "lab"
}
