Create document and automatically sign it using workflow action
Circularo REST API example
Creates the file-based document with signature fields for current user. Then automatically signs the document during workflow action.
Step 1 - Sign in
Sign user in.
Endpoint
POST - /login
Example
/login
Content-Type: application/json
{
"name": "mary.griffin@circularo.com",
"password": "#32Password1!",
"tenant": "default"
}
Response
Note following properties in response object:
- token - In response object at position ‘token‘. It may have value of “twGIvOa08x9xrYS0nJOJTAhFMFeItQE09BzqY57ffcuZCumFlRzjvksSug9NVYk4“.
Step 2 - Create new PDF file
Create new PDF file in the Circularo.
Endpoint
POST - /files/saveFile
Example
/files/saveFile?token=twGIvOa08x9xrYS0nJOJTAhFMFeItQE09BzqY57ffcuZCumFlRzjvksSug9NVYk4
Content-Type: multipart/form-data
{
"file": "blob",
"fileName": "My PDF file"
}
Response
Note following properties in response object:
- fileId - In response object at position ‘file.id‘. It may have value of “PjwdWcxd22r8EaAU0ijv4mpIdZdQ76BfPrznpUA4ZCsPBjaUDBv3qu7SBD6QYmLc“.
The file is now created.
Step 3 - Create PDF based document with signature field
Creates new document from existing PDF file. Also creates signature field for current user usable for auto-sign action.
Endpoint
POST - /documents
Example
/documents?token=twGIvOa08x9xrYS0nJOJTAhFMFeItQE09BzqY57ffcuZCumFlRzjvksSug9NVYk4
Content-Type: application/json
{
"body": {
"documentType": "d_autosign",
"documentTitle": "My file based document",
"pdfFile": {
"content": "PjwdWcxd22r8EaAU0ijv4mpIdZdQ76BfPrznpUA4ZCsPBjaUDBv3qu7SBD6QYmLc"
}
},
"definitionType": "ext",
"workflow": "wf_autosign",
"optionalData": {
"signFields": [
{
"user": "mary.griffin@circularo.com",
"type": "signature",
"page": 1,
"usage": "autosign",
"position": {
"percentX": 0.5,
"percentY": 0.3,
"percentWidth": 0.4,
"percentHeight": 0.1
}
}
]
}
}
Response
Note following properties in response object:
- documentId - In response object at position ‘results[0].documentId‘. It may have value of “ad920150-8909-47d4-8519-93b8c3f2943b“.
- workflowId - In response object at position ‘results[0].workflow.id‘. It may have value of “d229f09c-c44d-4921-861a-479e8faf1233“.
The PDF based document with signature field is now created.
Step 4 - Execute auto-sign workflow action
Executes auto-sign action on existing document. Actual value of “actionId” parameter depends on used workflow type.
Endpoint
POST - /inbox/action
Example
/inbox/action?token=twGIvOa08x9xrYS0nJOJTAhFMFeItQE09BzqY57ffcuZCumFlRzjvksSug9NVYk4
Content-Type: application/json
{
"workflowId": "d229f09c-c44d-4921-861a-479e8faf1233",
"actionId": 1
}
The document is now signed.
Step 5 - Sign out (Optional)
Sign user out.
Endpoint
GET - /logout
Example
/logout?token=twGIvOa08x9xrYS0nJOJTAhFMFeItQE09BzqY57ffcuZCumFlRzjvksSug9NVYk4