Discussions
PDF Attachement
Please refer to the latest question below under the line.
Hi
Can I know which API can we use to retrieve the pdf attachment in the job history of any client?
Thanks
K
about 1 month ago by Cody
Hi Karan,
To retrieve PDF attachments from job history, you'll need to use the /attachment endpoint. Here's how it works:
First, query the /jobactivity endpoint to get the attachment UUID from the job history.
Then use the /attachment endpoint with that UUID to download the actual PDF file.
The attachment endpoint supports both retrieving attachment metadata and downloading the actual file content. Make sure your OAuth scope or API key includes 'read_attachments' permission.
Thanks,
Cody
Hi Cody
I tried using the above method and there seems to be a bit of confusion, I attached a PDF report on the job card of the client which shows on the left side panel of the work order and now I want to know in order for me to download or view that pdf file on my web based client portal, how can I achieve this, is there any Specific API or a better way to do that?
Thanks
0
0
32 minutes ago by Cody
Hi Karan,
I understand you've attached a PDF to the job card and now want to download or view it in your web-based client portal. For attachments that appear in the left side panel, you'll need to use a slightly different approach than what we discussed earlier.
Here's the step-by-step process:
Find the attachment UUID: Query the /attachment endpoint with a filter to find attachments associated with your specific job:
GET /attachment.json?$filter=job_uuid eq 'YOUR_JOB_UUID'
- Download the file content: Once you have the attachment UUID, you can download the actual PDF file using:
GET /attachment/{uuid}/download
This will return the binary content of the PDF file that you can then serve to your client portal.
Important considerations for your client portal:
Ensure your OAuth scope or API key includes read_attachments permission
The /attachment endpoint supports both retrieving attachment metadata and downloading the actual file content
Consider implementing proper file type validation and security measures when serving files to clients
Alternative approach: You can also filter attachments to find job-related files using filtering options: $filter=FIELD OPERATOR 'VALUE', ensuring your filter statement is properly URL-encoded.
For more detailed information about working with attachments, refer to the guide on Attaching files to Job Diary .
Thanks,
Cody
Hi Cody
Thank you for the response, however, can you confirm this approach download the pdf or just the content that's inside the pdf. I want to download the entire pdf as an attachment instead of downloading the fields that are inside the pdf?
I have a compliance report and invoice attached on the work order on the left panel, and want to download or view that report on the web-based portal, I am not sure how to do because as per what you have mentioned it seems like it is only going to show the fields inside the pdf if they are linked?
Let me know if the download is possible of the entire file ?
Thanks
K