Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDFCLOUD-2826 Add upload + raw JSON curl samples #51

Merged
merged 3 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cURL/Endpoint Examples/JSON Payload/README.md
Original file line number Diff line number Diff line change
@@ -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.
14 changes: 14 additions & 0 deletions cURL/Endpoint Examples/JSON Payload/bmp.sh
Original file line number Diff line number Diff line change
@@ -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 '.'
14 changes: 14 additions & 0 deletions cURL/Endpoint Examples/JSON Payload/compressed-pdf.sh
Original file line number Diff line number Diff line change
@@ -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 '.'
Original file line number Diff line number Diff line change
@@ -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 '.'
14 changes: 14 additions & 0 deletions cURL/Endpoint Examples/JSON Payload/decrypted-pdf.sh
Original file line number Diff line number Diff line change
@@ -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 '.'
Original file line number Diff line number Diff line change
@@ -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 '.'
Original file line number Diff line number Diff line change
@@ -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 '.'
14 changes: 14 additions & 0 deletions cURL/Endpoint Examples/JSON Payload/encrypted-pdf.sh
Original file line number Diff line number Diff line change
@@ -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 '.'
14 changes: 14 additions & 0 deletions cURL/Endpoint Examples/JSON Payload/exported-form-data.sh
Original file line number Diff line number Diff line change
@@ -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 '.'
14 changes: 14 additions & 0 deletions cURL/Endpoint Examples/JSON Payload/extracted-text.sh
Original file line number Diff line number Diff line change
@@ -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 '.'
14 changes: 14 additions & 0 deletions cURL/Endpoint Examples/JSON Payload/flattened-annotations-pdf.sh
Original file line number Diff line number Diff line change
@@ -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 '.'
14 changes: 14 additions & 0 deletions cURL/Endpoint Examples/JSON Payload/flattened-forms-pdf.sh
Original file line number Diff line number Diff line change
@@ -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 '.'
14 changes: 14 additions & 0 deletions cURL/Endpoint Examples/JSON Payload/flattened-layers-pdf.sh
Original file line number Diff line number Diff line change
@@ -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 '.'
Original file line number Diff line number Diff line change
@@ -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 '.'
Original file line number Diff line number Diff line change
@@ -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 '.'
1 change: 1 addition & 0 deletions cURL/Endpoint Examples/JSON Payload/get-resource.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
curl -X GET "https://api.pdfrest.com/resource/xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx?format=url"
14 changes: 14 additions & 0 deletions cURL/Endpoint Examples/JSON Payload/gif.sh
Original file line number Diff line number Diff line change
@@ -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 '.'
14 changes: 14 additions & 0 deletions cURL/Endpoint Examples/JSON Payload/jpg.sh
Original file line number Diff line number Diff line change
@@ -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 '.'
14 changes: 14 additions & 0 deletions cURL/Endpoint Examples/JSON Payload/linearized-pdf.sh
Original file line number Diff line number Diff line change
@@ -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 '.'
22 changes: 22 additions & 0 deletions cURL/Endpoint Examples/JSON Payload/merged-pdf.sh
Original file line number Diff line number Diff line change
@@ -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 '.'
4 changes: 4 additions & 0 deletions cURL/Endpoint Examples/JSON Payload/pdf-html-to-pdf.sh
Original file line number Diff line number Diff line change
@@ -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 '.'
14 changes: 14 additions & 0 deletions cURL/Endpoint Examples/JSON Payload/pdf-info.sh
Original file line number Diff line number Diff line change
@@ -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 '.'
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 '.'
22 changes: 22 additions & 0 deletions cURL/Endpoint Examples/JSON Payload/pdf-with-added-image.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_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 '.'
22 changes: 22 additions & 0 deletions cURL/Endpoint Examples/JSON Payload/pdf-with-imported-form-data.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_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 '.'
14 changes: 14 additions & 0 deletions cURL/Endpoint Examples/JSON Payload/pdf.sh
Original file line number Diff line number Diff line change
@@ -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 '.'
Loading