-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pdf-with-added-attachment json sample
- Loading branch information
1 parent
47de4d9
commit 91cd584
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
cURL/Endpoint Examples/JSON Payload/pdf-with-added-attachment.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 '.' |