Document Creation
There are three stages to creating a document. First a workflow must be created, then started, and finally the finished document can be downloaded.
1. Create a workflow
A workflow can be created by providing the necessary information, like the template ID or properties in the content
section, to the workflow API:
PUT /v2/workflows HTTP/1.1
Host: api.docugate.cloud
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="workflow.json"
Content-Type: application/json
{
"source_templates": [
{
"template_id": "66bed892-e33f-4c35-8eef-d8f86e6a2498"
}
],
"content": {
"firstname": "John",
"lastname": "Doe",
"address": "221B Baker Street, London"
}
}
----WebKitFormBoundary7MA4YWxkTrZu0gW
On success, the API will return a 200 OK
with detailed information on the created workflow in the body:
{
"id": "3f55861e-4073-4fdf-9204-bdaaba832900",
"created_by": "26db9a36-5a06-4021-9b08-5d2b86c9e649",
"created_at": "2021-10-25T10:00:00.2538567+00:00",
"state": "Created",
"validity": true,
"source_templates": [
{
"template_id": "66bed892-e33f-4c35-8eef-d8f86e6a2498",
"template_descriptor": null,
"doc_language": null,
"artifact": null
}
],
"labels": null
}
2. Start the workflow
Starting the workflow will trigger the actual creation of the document:
PUT /v2/workflows/{workflowId}/start HTTP/1.1
Host: api.docugate.cloud
On success, the API will respond with a 204 No Content
.
3. Wait for workflow completion and get document
After the document is created, the status will be set to Completed
. The compiled file will be in the result_resources
of the workflow and can be downloaded:
GET /v2/workflows/{workflowId}/resources/document.docx HTTP/1.1
Host: api.docugate.cloud
The API will respond with a 200 OK
and have the document in the body.