Skip to content

Commit

Permalink
Add pdf-with-added-attachment json sample
Browse files Browse the repository at this point in the history
  • Loading branch information
datalogics-tsmith committed Nov 2, 2023
1 parent 47de4d9 commit 91cd584
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions cURL/Endpoint Examples/JSON Payload/pdf-with-added-attachment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

UPLOAD_PDF_FILE_ID=$(curl --location 'https://api.pdfrest.com/upload' \
--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \
--header 'content-filename: filename.pdf' \
--data-binary '@/path/to/pdf_file' \
| jq -r '.files.[0].id')

echo "PDF file successfully uploaded with an ID of: $UPLOAD_PDF_FILE_ID"

UPLOAD_ATTACHMENT_FILE_ID=$(curl --location 'https://api.pdfrest.com/upload' \
--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \
--header 'content-filename: filename.xml' \
--data-binary '@/path/to/attachment_file' \
| jq -r '.files.[0].id')

echo "Attachment file successfully uploaded with an ID of: $UPLOAD_ATTACHMENT_FILE_ID"

curl 'https://api.pdfrest.com/pdf-with-added-attachment' \
--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data-raw "{ \"id\": \"$UPLOAD_PDF_FILE_ID\", \"id_to_attach\": \"$UPLOAD_ATTACHMENT_FILE_ID\"}" | jq -r '.'

0 comments on commit 91cd584

Please sign in to comment.