Cloud Render using cURL

This example shows how to generate a PDF from a DOCX template using cURL.  It calls the Docmosis REST API to merge the data with the template and stream the result back.

The sample code includes the instructions to get started. You will need a Free Trial and then plug your Docmosis Cloud access key into the code below, then run.

Note: This code sample is written to specifically work with DWS4.

The linux command:

curl -F data=@data.txt -F templateName=samples/WelcomeTemplate.docx -F outputName=myWelcome.pdf -F accessKey=XXX -o myWelcome.pdf https://us1.dws4.docmosis.com/api/render

will call the cloud service to render the template samples/WelcomeTemplate.docx to create file myWelcome.pdf. 

The access key above is XXX which you should replace with your access key

The region url above is for USA, for EU use https://eu1.dws4.docmosis.com/api/render
for AUS use https://au1.dws4.docmosis.com/api/render

You will also need to creqate a data.txt file that contains the data in JSON format, that should look like this:
 
{
 "title":"Welcome to Docmosis via cURL",
 "messages":
 [{"msg":"This cloud experience is better than I thought."},
  {"msg":"The sun is shining."},
  {"msg":"Right, now back to work."}]
}

Feedback

Invalid Input

Sorry, this field will only accept letters and numbers, and not special characters, to limit spam. Please also consider contacting support@docmosis.com if you need help with this article.

Sorry, this field will only accept letters and numbers, and not special characters, to limit spam.

Invalid Input

Applies To

Docmosis-Java Tornado Cloud
Version(s) - - DWS4