diff --git a/cURL/Endpoint Examples/JSON Payload/README.md b/cURL/Endpoint Examples/JSON Payload/README.md new file mode 100644 index 0000000..bd16590 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/README.md @@ -0,0 +1,7 @@ +This directory contains examples of how to call each endpoint of the +PdfRest API using cURL. Please refer to https://pdfrest.com/documentation.html +for accepted inputs, options, and other specifics about individual endpoints. + +Note that these samples use the jq processor (https://jqlang.github.io/jq/) in +order to parse the IDs of uploaded files and pretty-print the final output +JSON. diff --git a/cURL/Endpoint Examples/JSON Payload/bmp.sh b/cURL/Endpoint Examples/JSON Payload/bmp.sh new file mode 100755 index 0000000..ad2b4d8 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/bmp.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/bmp' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/compressed-pdf.sh b/cURL/Endpoint Examples/JSON Payload/compressed-pdf.sh new file mode 100755 index 0000000..4c150fc --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/compressed-pdf.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/compressed-pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\", \"compression_level\": \"medium\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/decrypted-pdf-with-permissions-password.sh b/cURL/Endpoint Examples/JSON Payload/decrypted-pdf-with-permissions-password.sh new file mode 100755 index 0000000..9ccc7e7 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/decrypted-pdf-with-permissions-password.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/decrypted-pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\", \"current_open_password\": \"encrypted\", \"current_permissions_password\": \"restricted\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/decrypted-pdf.sh b/cURL/Endpoint Examples/JSON Payload/decrypted-pdf.sh new file mode 100755 index 0000000..86fc9f6 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/decrypted-pdf.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/decrypted-pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\", \"current_open_password\": \"encrypted\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/encrypted-pdf-change-password.sh b/cURL/Endpoint Examples/JSON Payload/encrypted-pdf-change-password.sh new file mode 100755 index 0000000..301dc1b --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/encrypted-pdf-change-password.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/encrypted-pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\", \"current_open_password\": \"password\", \"new_open_password\": \"new_password\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/encrypted-pdf-new-password-with-permissions-password.sh b/cURL/Endpoint Examples/JSON Payload/encrypted-pdf-new-password-with-permissions-password.sh new file mode 100755 index 0000000..8b6136a --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/encrypted-pdf-new-password-with-permissions-password.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/encrypted-pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\", \"current_permissions_password\": \"password\", \"new_open_password\": \"new_password\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/encrypted-pdf.sh b/cURL/Endpoint Examples/JSON Payload/encrypted-pdf.sh new file mode 100755 index 0000000..0fc3d01 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/encrypted-pdf.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/encrypted-pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\", \"new_open_password\": \"new_password\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/exported-form-data.sh b/cURL/Endpoint Examples/JSON Payload/exported-form-data.sh new file mode 100755 index 0000000..7966406 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/exported-form-data.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/exported-form-data' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\", \"data_format\": \"xml\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/extracted-text.sh b/cURL/Endpoint Examples/JSON Payload/extracted-text.sh new file mode 100755 index 0000000..25b4899 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/extracted-text.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/extracted-text' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/flattened-annotations-pdf.sh b/cURL/Endpoint Examples/JSON Payload/flattened-annotations-pdf.sh new file mode 100755 index 0000000..0a8feba --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/flattened-annotations-pdf.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/flattened-annotations-pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/flattened-forms-pdf.sh b/cURL/Endpoint Examples/JSON Payload/flattened-forms-pdf.sh new file mode 100755 index 0000000..8163425 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/flattened-forms-pdf.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/flattened-forms-pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/flattened-layers-pdf.sh b/cURL/Endpoint Examples/JSON Payload/flattened-layers-pdf.sh new file mode 100755 index 0000000..0ced161 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/flattened-layers-pdf.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/flattened-layers-pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/flattened-transparencies-pdf-medium.sh b/cURL/Endpoint Examples/JSON Payload/flattened-transparencies-pdf-medium.sh new file mode 100755 index 0000000..36af112 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/flattened-transparencies-pdf-medium.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/flattened-transparencies-pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\", \"quality\": \"medium\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/flattened-transparencies-pdf.sh b/cURL/Endpoint Examples/JSON Payload/flattened-transparencies-pdf.sh new file mode 100755 index 0000000..9d925c7 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/flattened-transparencies-pdf.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/flattened-transparencies-pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/get-resource.sh b/cURL/Endpoint Examples/JSON Payload/get-resource.sh new file mode 100755 index 0000000..fddd19d --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/get-resource.sh @@ -0,0 +1 @@ +curl -X GET "https://api.pdfrest.com/resource/xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx?format=url" diff --git a/cURL/Endpoint Examples/JSON Payload/gif.sh b/cURL/Endpoint Examples/JSON Payload/gif.sh new file mode 100755 index 0000000..bfaf04f --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/gif.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/gif' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/jpg.sh b/cURL/Endpoint Examples/JSON Payload/jpg.sh new file mode 100755 index 0000000..253f7ab --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/jpg.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/jpg' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/linearized-pdf.sh b/cURL/Endpoint Examples/JSON Payload/linearized-pdf.sh new file mode 100755 index 0000000..a927263 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/linearized-pdf.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/linearized-pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/merged-pdf.sh b/cURL/Endpoint Examples/JSON Payload/merged-pdf.sh new file mode 100755 index 0000000..187eb63 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/merged-pdf.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +UPLOAD_FIRST_FILE_ID=$(curl --location 'https://api.pdfrest.com/upload' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'content-filename: first_filename.pdf' \ +--data-binary '@/path/to/first_file' \ + | jq -r '.files.[0].id') + + echo "First file successfully uploaded with an ID of: $UPLOAD_FIRST_FILE_ID" + +UPLOAD_SECOND_FILE_ID=$(curl --location 'https://api.pdfrest.com/upload' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'content-filename: second_filename.pdf' \ +--data-binary '@/path/to/second_file' \ +| jq -r '.files.[0].id') + +echo "Second file successfully uploaded with an ID of: $UPLOAD_SECOND_FILE_ID" + +curl 'https://api.pdfrest.com/merged-pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": [\"$UPLOAD_FIRST_FILE_ID\", \"$UPLOAD_SECOND_FILE_ID\"], \"pages\":[1,1], \"type\":[\"id\", \"id\"] }" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/pdf-html-to-pdf.sh b/cURL/Endpoint Examples/JSON Payload/pdf-html-to-pdf.sh new file mode 100755 index 0000000..ef5f39b --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/pdf-html-to-pdf.sh @@ -0,0 +1,4 @@ +curl 'https://api.pdfrest.com/pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw '{ "url": "https://pdfrest.com/"}' | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/pdf-info.sh b/cURL/Endpoint Examples/JSON Payload/pdf-info.sh new file mode 100755 index 0000000..4c8cd26 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/pdf-info.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/pdf-info' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\", \"queries\": \"title,page_count,doc_language,author\"}" | jq -r '.' 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 '.' diff --git a/cURL/Endpoint Examples/JSON Payload/pdf-with-added-image.sh b/cURL/Endpoint Examples/JSON Payload/pdf-with-added-image.sh new file mode 100755 index 0000000..9e23a3f --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/pdf-with-added-image.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_IMAGE_FILE_ID=$(curl --location 'https://api.pdfrest.com/upload' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'content-filename: filename.png' \ +--data-binary '@/path/to/image_file' \ +| jq -r '.files.[0].id') + +echo "Image file successfully uploaded with an ID of: $UPLOAD_IMAGE_FILE_ID" + +curl 'https://api.pdfrest.com/pdf-with-added-image' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_PDF_FILE_ID\", \"image_id\": \"$UPLOAD_IMAGE_FILE_ID\", \"page\":1, \"x\":0, \"y\":0 }" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/pdf-with-imported-form-data.sh b/cURL/Endpoint Examples/JSON Payload/pdf-with-imported-form-data.sh new file mode 100644 index 0000000..0b5a274 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/pdf-with-imported-form-data.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_DATA_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/data_file' \ +| jq -r '.files.[0].id') + +echo "Data file successfully uploaded with an ID of: $UPLOAD_DATA_FILE_ID" + +curl 'https://api.pdfrest.com/pdf-with-imported-form-data' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_PDF_FILE_ID\", \"data_file_id\": \"$UPLOAD_DATA_FILE_ID\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/pdf.sh b/cURL/Endpoint Examples/JSON Payload/pdf.sh new file mode 100755 index 0000000..3962af7 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/pdf.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_ID=$(curl --location 'https://api.pdfrest.com/upload' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'content-filename: filename.png' \ +--data-binary '@//path/to/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/pdfa.sh b/cURL/Endpoint Examples/JSON Payload/pdfa.sh new file mode 100755 index 0000000..2a57d2c --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/pdfa.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/pdfa' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\", \"output_type\": \"PDF/A-1b\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/pdfx.sh b/cURL/Endpoint Examples/JSON Payload/pdfx.sh new file mode 100755 index 0000000..431d0a3 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/pdfx.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/pdfx' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\", \"output_type\": \"PDF/X-4\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/png.sh b/cURL/Endpoint Examples/JSON Payload/png.sh new file mode 100755 index 0000000..f1fa60c --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/png.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/png' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/restricted-pdf-add-password-and-restrictions.sh b/cURL/Endpoint Examples/JSON Payload/restricted-pdf-add-password-and-restrictions.sh new file mode 100755 index 0000000..54031c0 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/restricted-pdf-add-password-and-restrictions.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/restricted-pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\", \"new_permissions_password\": \"restricted\", \"restrictions\": [\"print_low\", \"accessibility_off\"]}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/restricted-pdf-add-password-with-open-password.sh b/cURL/Endpoint Examples/JSON Payload/restricted-pdf-add-password-with-open-password.sh new file mode 100755 index 0000000..4a50c29 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/restricted-pdf-add-password-with-open-password.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/restricted-pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\", \"current_open_password\": \"encrypted\", \"new_permissions_password\": \"restricted\", \"restrictions\": [\"print_low\"]}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/restricted-pdf-change-password.sh b/cURL/Endpoint Examples/JSON Payload/restricted-pdf-change-password.sh new file mode 100755 index 0000000..6519b9e --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/restricted-pdf-change-password.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/restricted-pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\", \"current_permissions_password\": \"password\", \"new_permissions_password\": \"restricted\", \"restrictions\": [\"print_low\"]}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/restricted-pdf.sh b/cURL/Endpoint Examples/JSON Payload/restricted-pdf.sh new file mode 100755 index 0000000..c25e4f2 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/restricted-pdf.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/restricted-pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\",\"new_permissions_password\": \"restricted\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/split-pdf-custom-ranges.sh b/cURL/Endpoint Examples/JSON Payload/split-pdf-custom-ranges.sh new file mode 100755 index 0000000..b55eae4 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/split-pdf-custom-ranges.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/split-pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\", \"pages\": [1,2]}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/split-pdf-delete-page.sh b/cURL/Endpoint Examples/JSON Payload/split-pdf-delete-page.sh new file mode 100755 index 0000000..16922a7 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/split-pdf-delete-page.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/split-pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\", \"pages\": [\"1-3\",5,6]}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/split-pdf-odd-and-even.sh b/cURL/Endpoint Examples/JSON Payload/split-pdf-odd-and-even.sh new file mode 100755 index 0000000..a60bd02 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/split-pdf-odd-and-even.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/split-pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\", \"pages\": [\"even\",\"odd\"]}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/split-pdf.sh b/cURL/Endpoint Examples/JSON Payload/split-pdf.sh new file mode 100755 index 0000000..69d4604 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/split-pdf.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/split-pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/tif.sh b/cURL/Endpoint Examples/JSON Payload/tif.sh new file mode 100755 index 0000000..14c660c --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/tif.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/tif' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/unrestricted-pdf-with-open-password.sh b/cURL/Endpoint Examples/JSON Payload/unrestricted-pdf-with-open-password.sh new file mode 100755 index 0000000..62e30d4 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/unrestricted-pdf-with-open-password.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/unrestricted-pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\",\"current_open_password\": \"restricted\", \"current_permissions_password\":\"restricted\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/unrestricted-pdf.sh b/cURL/Endpoint Examples/JSON Payload/unrestricted-pdf.sh new file mode 100755 index 0000000..fe5fda3 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/unrestricted-pdf.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +UPLOAD_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/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" + +curl 'https://api.pdfrest.com/unrestricted-pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_ID\",\"current_permissions_password\":\"restricted\"}" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/upload.sh b/cURL/Endpoint Examples/JSON Payload/upload.sh new file mode 100755 index 0000000..d720698 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/upload.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +UPLOAD_ID=$(curl --location 'http://localhost:3000/upload' \ +--header 'api-key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'content-filename: filename.pdf' \ +--data-binary '@/path/to/file' \ + | jq -r '.files.[0].id') + +echo "File successfully uploaded with an ID of: $UPLOAD_ID" diff --git a/cURL/Endpoint Examples/JSON Payload/watermarked-pdf-image.sh b/cURL/Endpoint Examples/JSON Payload/watermarked-pdf-image.sh new file mode 100755 index 0000000..75b398f --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/watermarked-pdf-image.sh @@ -0,0 +1,21 @@ +#!/bin/sh +UPLOAD_PDF_FILE_ID=$(curl --location 'https://api.pdfrest.com/upload' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'content-filename: pdf_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_WATERMARK_FILE_ID=$(curl --location 'https://api.pdfrest.com/upload' \ + --header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ + --header 'content-filename: watermark_filename.pdf' \ + --data-binary '@/path/to/watermark_file' \ +| jq -r '.files.[0].id') + +echo "Watermark file successfully uploaded with an ID of: $UPLOAD_WATERMARK_FILE_ID" + +curl 'https://api.pdfrest.com/watermarked-pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_PDF_FILE_ID\", \"watermark_file_id\": \"$UPLOAD_WATERMARK_FILE_ID\" }" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/watermarked-pdf.sh b/cURL/Endpoint Examples/JSON Payload/watermarked-pdf.sh new file mode 100755 index 0000000..67ce36f --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/watermarked-pdf.sh @@ -0,0 +1,15 @@ +#!/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/file' \ + | jq -r '.files.[0].id') + + echo "PDF file successfully uploaded with an ID of: $UPLOAD_PDF_FILE_ID" + + +curl 'https://api.pdfrest.com/watermarked-pdf' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": \"$UPLOAD_PDF_FILE_ID\", \"watermark_text\": \"watermark\" }" | jq -r '.' diff --git a/cURL/Endpoint Examples/JSON Payload/zip.sh b/cURL/Endpoint Examples/JSON Payload/zip.sh new file mode 100755 index 0000000..4353c63 --- /dev/null +++ b/cURL/Endpoint Examples/JSON Payload/zip.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +UPLOAD_FIRST_FILE_ID=$(curl --location 'https://api.pdfrest.com/upload' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'content-filename: first_filename.pdf' \ +--data-binary '@/path/to/first_file' \ + | jq -r '.files.[0].id') + + echo "First file successfully uploaded with an ID of: $UPLOAD_FIRST_FILE_ID" + + UPLOAD_SECOND_FILE_ID=$(curl --location 'https://api.pdfrest.com/upload' \ + --header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ + --header 'content-filename: second_filename.pdf' \ + --data-binary '@//path/to/second_file' \ +| jq -r '.files.[0].id') + +echo "Second file successfully uploaded with an ID of: $UPLOAD_SECOND_FILE_ID" + +curl 'https://api.pdfrest.com/zip' \ +--header 'Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' \ +--header 'Content-Type: application/json' \ +--data-raw "{ \"id\": [\"$UPLOAD_FIRST_FILE_ID\", \"$UPLOAD_SECOND_FILE_ID\"]}" | jq -r '.'