Skip to main content

Process API

Specifications for Low-code platform's workflow engine related API interfaces, including rules for request parameters and return values, are stipulated in this agreement.

Interface Validation

To call the API interfaces, user authentication information must be added to the request headers. For details, please refer to Interface Validation.

API List

NameRequest Operation
Start ApprovalPOST
Save Approval as DraftPOST
Submit Draft ApplicationPOST
Submit Approval RequestPOST

API Specifications

Below are the detailed specifications for each workflow API.

Start Approval

Create a new approval request in draft status.

URI

/api/workflow/v2/draft

Method

POST

Request Parameters

The following parameters are required when requesting this interface.

NameTypeDescription
instanceobjectApproval Form Field Values

The 'instance' attribute is described as follows:

NameTypeDescription
spacestringWorkspace ID
flowstringProcess ID
applicantstringApplicant ID
{
"instance": {
"space": "hKdnwE55WcnWveYxS",
"flow": "BayiYu3sk2hv3M2HW",
"applicant": "62ede4f62161e377e35de58c"
}
}

Response

  • The format of the return value when the API interface request is successful is as follows:
NameTypeDescription
instanceobjectApproval form field value

Where the instance property is described as follows:

NameTypeDescription
_idstringThe successfully created application form ID
spacestringWorkspace ID
flowstringWorkflow ID
flow_versionstringWorkflow version ID
formstringForm ID
form_versionstringForm version ID
{
"instance": {
"_id": "zMiGNe2sJm9KuruvM",
"space": "hKdnwE55WcnWveYxS",
"flow": "BayiYu3sk2hv3M2HW",
"flow_version": "Nvc5wjsgHYkXnNHhk",
"form": "Pdq8neQvT7fv5aTyd",
"form_version": "thX4kKBAx6iCgciWD"
}
}

The instance returned in the response contains information about the successfully created approval record.

Save Draft Approval Form

URI

/api/workflow/v2/instance/save

Method

POST

Request parameters.

The following parameters need to be passed when requesting this API.

NameTypeDescription
instanceobjectApproval Form Field Values
{
"instance": {
"_id": "zMiGNe2sJm9KuruvM",
"space": "hKdnwE55WcnWveYxS",
"flow": "BayiYu3sk2hv3M2HW",
"flow_version": "Nvc5wjsgHYkXnNHhk",
"form": "Pdq8neQvT7fv5aTyd",
"form_version": "thX4kKBAx6iCgciWD",
"applicant": "62ede4f62161e377e35de58c",
"applicant_name": "xxx",
"applicant_organization": "XypyNbzGCJbHMNyWv",
"applicant_organization_name": "xxx",
"applicant_organization_fullname": "xxx",
"code": "",
"traces": [
{
"_id": "7f316cb404fddf2098c8fd2d",
"approves": [
{
"_id": "97628d0b9a33b541816caeeb",
"description": "",
"values": {
"field1": "xx",
"field2": "xx",
"field3": "xx"
},
"next_steps": [
{
"step": "e28faf97-a1c4-4bdd-90e5-1b43d42aa10b",
"users": []
}
]
}
]
}
],
"submit_date": xxx
}
}

Response

  • The format of the successful API interface request response is as follows:
NameTypeDescription
instancebooleanWas the operation successful?
{
"instance": true
}

Submitting a Draft Application

Submit an application in draft status to the next step

URI

/api/workflow/submit

Method

POST

Request Parameters

The following parameters need to be passed when requesting this API.

NameTypeDescription
Instancesobject[]The content of the application form.
{
"Instances": [{
"_id": "e6viWhvARgo4xSxBC",
"inbox_users": [],
"name": "Test",
"submitter": "62ede4f62161e377e35de58c",
"flow": "BayiYu3sk2hv3M2HW",
"applicant": "62ede4f62161e377e35de58c",
"traces": [{
"_id": "0aed02a8113d7e1a22d5a245",
"step": "Ryu58zkQKrFLdvWpw",
"approves": [{
"_id": "5865e212c0e80024005090f9",
"description": "",
"values": {
"field1": "xxx",
"field2": "xxx",
"field3": "xxx"
},
"next_steps": [{
"step": "e28faf97-a1c4-4bdd-90e5-1b43d42aa10b",
"users": [
"62ede4f62161e377e35de58c"
]
}]
}]
}]
}]
}

The traces contains the signature history for each step, while approves contains the approval process within each signature history, which records detailed information about the approval form.

Response

  • When this API interface is requested successfully, the format of the return value is as follows:
{
"result": [...]
}

The result returns an array of objects. The key-value information contained in this array is shown as follows:

NameTypeDescription
alertsstringPrompt messages

The alerts mainly prompts whether the process version has been upgraded.

  • When this API interface fails to request, the format of the return value is as follows:
{
errors: [{ errorMessage: "..." }]
}

Submitting an Approval Application

Submit an application in approval status to the next step.

URI

/api/workflow/engine

Method

POST

Request Parameters

The following parameters need to be passed when requesting this API.

NameTypeDescription
Approvalsobject[]The content of the approval

Response

  • When this API interface is requested successfully, an empty object is returned.

  • When this API interface fails to request, the format of the return value is as follows:

{
errors: [{ errorMessage: "..." }]
}