Document PDFs
Download PDF versions of driver documents
Creating a PDF version of a driver document is an asynchronous process. There are two steps:
- Trigger PDF creation job
- Check job status and download PDF
Step 1: Trigger PDF creation job
The following triggers the creation of a PDF version of the document with documentId
1654973_1593713510968
:
curl --request POST 'https://api.samsara.com/fleet/documents/pdfs' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <<token>>' \
--data-raw '{
"documentId": "1654973_1593713510968"
}'
The response will contain the id
of the PDF job as well as the original documentId
:
{
"data": {
"id": "4407d645-93a2-4a4d-8702-468cb5f9bf34",
"documentId": "1654973_1593713510968"
}
}
Step 2: Check job status and download PDF
Once you've triggered the PDF job, you can check its status and (if completed) download the PDF.
You supply the id
of the PDF job from step 1 as a URL parameter to the GET request:
curl --request GET 'https://api.samsara.com/fleet/documents/pdfs/4407d645-93a2-4a4d-8702-468cb5f9bf34' \
--header 'Authorization: Bearer <<token>>'
{
"data": {
"id": "4407d645-93a2-4a4d-8702-468cb5f9bf34",
"documentId": "1654973_1593713510968",
"jobStatus": "completed",
"requestedAtTime": "2020-07-02T18:34:06.456Z",
"completedAtTime": "2020-07-02T18:34:10.176Z",
"downloadDocumentPdfUrl": "https://samsara-driver-document-pdfs.s3.us-west-2.amazonaws.com/org/53729/4407d645-93a2-4a4d-8702-468cb5f9bf34/Stop_Tasks-Tyler_Freckmann-20200702.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA3LY3RNWSCKZRLY5Q%2F20200702%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20200702T184155Z&X-Amz-Expires=604800&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEMr%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLXdlc3QtMiJHMEUCIQCuA%2B496MTQeVCf7qvb0yrhFzjp44TM2s%2BJof2h80VfLgIgQsfLaurrheam%2BbMnNc4L3%2B5c0x6f3voTaRLetnwieykq2gMIYxACGgw3ODEyMDQ5NDIyNDQiDPGvTuUOUB4obb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Amz-Signature=9d4a39844cbdb46a05631fa9d589da9f58d59903bc1471e4307c519e87ee6031"
}
}
The response will contain the jobStatus
of the PDF job. This can be completed
, requested
, or processing
. If the job is not completed, it is recommended that you wait 5 seconds and try again.
Once the job has been completed
, the downloadDocumentPdfUrl
will provide a URL to the PDF document that expires after 7 days. If the URL has expired, you may request creation of the PDF again as described in step 1.
Updated over 4 years ago