Skip to content

Instantly share code, notes, and snippets.

@jqr
Forked from illbzo1/doc_raptor_async_example.sh
Last active April 8, 2018 01:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jqr/006215da666f9fde0eaa to your computer and use it in GitHub Desktop.
Save jqr/006215da666f9fde0eaa to your computer and use it in GitHub Desktop.
# This example will create a sample asynchronous pdf document with the authentication information as part of the POST data
curl http://docraptor.com/docs \
--fail --silent --show-error \
--header "Content-Type: application/json" \
--data '{
"user_credentials": "YOUR_API_KEY_HERE",
"doc": {
"name": "async_example.pdf",
"document_type":"pdf",
"async":"true",
"test":"true",
"document_url":"https://docraptor.com/examples/invoice.html"
}}' > async_response.json
# Making an asynchronous request will return some JSON with a status_id key like '{"status_id":"123454321"}'
cat async_response.json
# You can then use the status_id key to check the status of your asynchronous job
curl http://docraptor.com/status/bd8d083038970133a11022000b2b8d5d \
--fail --silent --show-error \
--header "Content-Type: application/json" \
--data '{
"user_credentials": "YOUR_API_KEY_HERE"}'
# Once your job has completed, you will recieve a response that contains the download_url for your document
{
"status": "completed",
"download_url": "http://docraptor.com/download/1a2b3c4d5e6f7g8h9i112233aabbccdd",
"number_of_pages": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment