Create an account
If you haven't done so already, start a Cloud trial here.
Generate a document using the API
This video gives an introduction to using the Docmosis Cloud Service via the API.
Download the cutdown Postman collection
Postman Collection Explained
Use this cut-down Postman collection as an easy way to visualize sending requests to the API and to see the responses.
You can download the Postman collection, from the link below the video, import the file into Postman.
The collection contains four endpoints: Ping, Environment Ready, List Templates and Render.
Base URL Explained
Each of the calls relies on the Postman variable, base URL. When using the API the URL determines the processing location.
The URL should start with the location that is storing the templates i.e. the location shown in the top right of the Cloud Console.
Ping Endpoint
The /ping endpoint allows users to conduct a simple connectivity test i.e. checks whether Postman is able to reach the Docmosis Cloud Service.
If base URL and end point are configured correctly, Postman will show a status code of 200 in the response.
If /ping is changed to a nonexistent endpoint then a 404 - Not Found status code is returned.
Environment Ready Endpoint
In addition to the base URL, the /environmentReady endpoint requires an API accessKey.
The accessKey is a combined username and password. Docmosis uses the accessKey to determine which account and environment to use and whether the user is allowed to use that account.
An request to this endpoint without a valid key will result in a 400 response code.
In case of errors, always check the body of the response, Docmosis will do its best to include a JSON message with details of why the call failed.
From the Cloud Account, locate and copy the accessKey and then paste it into Postman.
With a valid key, the request should succeed and the body of the message will contain the response with a 200 status code.
List Templates Endpoint
The /listTemplates endpoint retrieves all the templates stored in a selected processing location which is determined by the base URL.
Set the access key before sending a request. Check that the status code is 200 and the body will contain a JSON structure with the names of all folders and templates in the selected location.
A blank response with a 200 status code, indicates that the connected location does not have any templates. In that case check your base URL matches the location you are using in the Cloud Console.
Render Endpoint
The Render endpoint is the main document generation service.
The request requires at least four parameters: accessKey, output name, template name and data.
Set the access key. The output name will determine the format of the document being generated. For example a ".pdf" will result in a PDF file being generated.
The template name is set to the /samples/WelcomeTemplate.docx, which is an example that is preloaded to every Cloud account. In the Cloud Console you can see the full path to a template.
Using the Cloud Console generate sample JSON or XML data that matches the template , then copy and paste the data in the Render request.
Send the request to see the generated document in the Postman preview window. If you receive something other than a 200 success code, check body of the response for further guidance.
For example, if we change the template name to something that doesn’t exist, Docmosis will return a 400 response and the shortMessage will give you some further guidance.
Next Steps
- Explore Cloud APIs & SDKs: The Cloud API documentation is available in two places: An online interactive webpage or as a downloadable PDF.
- Create a Template: Create a template that matches your document from scratch, following the Template Tutorials.
- Explore Cloud Console : Get started with Cloud Console, the easiest way to iteratively test templates and data,without using an API.
Please reach out to our Support Team with any questions.

 
						