From 91cd5846373951a5b1dff6d1e5bd4cacf6b18320 Mon Sep 17 00:00:00 2001 From: Taylor Smith Date: Thu, 2 Nov 2023 13:29:44 -0500 Subject: [PATCH] Add pdf-with-added-attachment json sample --- .../JSON Payload/pdf-with-added-attachment.sh | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 cURL/Endpoint Examples/JSON Payload/pdf-with-added-attachment.sh diff --git a/cURL/Endpoint Examples/JSON Payload/pdf-with-added-attachment.sh b/cURL/Endpoint Examples/JSON Payload/pdf-with-added-attachment.sh new file mode 100755 index 0000000..55819fa --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/pdf-with-added-attachment.sh @@ -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 '.'