Skip to content

Instantly share code, notes, and snippets.

@illbzo1
Last active August 29, 2015 14:18
Show Gist options
  • Save illbzo1/f9e5dc5b14b9a7ecacf9 to your computer and use it in GitHub Desktop.
Save illbzo1/f9e5dc5b14b9a7ecacf9 to your computer and use it in GitHub Desktop.
Asynchronous Curl example for DocRaptor
#This example will create a sample asynchronous pdf document with the authentication information as part of the POST data
curl -H "Content-Type:application/json" -d'{"user_credentials":"YOUR_API_KEY_HERE", "doc":{"name":"async_example.pdf", "document_type":"pdf", "async":"true", "test":"true", "document_url":"https://docraptor.com"}}' http://docraptor.com/docs > async_example.pdf
#Making an asynchronous request will return some JSON with a status_id key like '{"status_id":"123454321"}'
cat async_example.pdf
#You can then use the status_id key to check the status of your asynchronous job
curl http://docraptor.com/status/123454321 -H "Content-Type:application/json" -d '{"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