Claim and Complete Task

Claim and submit the task form to complete the task.

Request Format

POST https://{apigw-address}/enos-bpm-service/v2.0/work/tasks/{taskId}/claim-complete

Request Parameters (Header)

Name Location Mandatory/Optional Data Type Description
Authorization Header Mandatory String The access token, which is represented by the bearer token. It can be obtained by invoking the Log In or Refresh Access Token API.

Request Parameters (URI)

Name Location (Path/Query) Mandatory/Optional Data Type Description
taskId Query Mandatory String The task ID。

Request Parameters (Body)

Name Mandatory/Optional Data Type Description
formId Optional String The ID of the submitted form.
values Mandatory Map (String for key, Object for value) The data in the submitted form, where the key is the form variable name, and the value is the submitted form value.
outcome Optional String The form action key.

Response Parameters

Name Data Type Description
data Boolean Whether the task is completed.

Error Codes

Code Description
33404 The task ID does not exist.
33500 The required fields are empty.

Samples

Request Sample

url: https://{apigw-address}/enos-bpm-service/v2.0/work/tasks/{taskId}/claim-complete

method: POST

headers: {"Authorization":"Bearer {your_access_token}"}

requestBody:
{
  "formId": "task_form_id",
  "outcome": "form_outcome",
  "values": {
    "field1": "value1",
    "field2": "value2"
  }
}

Return Sample

{
  "code": 0,
  "msg": "",
  "data": true
}

Java SDK Sample

public class BpmSdkTest{
       @Test
       public void claimCompleteTest() {
           String bearerToken = "your_bearer_token";
           String taskId = "taskId";
           CompleteFormRepresentation completeFormRepresentation = new CompleteFormRepresentation();
           completeFormRepresentation.setFormId("form_id");
           completeFormRepresentation.setOutcome("the_outcome_of_form");
           Map<String, Object> values = new HashMap<>();
           values.put("field1", "value1");
           values.put("field2", "value2");
           completeFormRepresentation.setValues(values);
           TaskClaimCompleteRequest request = new TaskClaimCompleteRequest(completeFormRepresentation, taskId, bearerToken);
           TaskCompleteResponse response = getPoseidon().getResponse(request, TaskCompleteResponse.class);
           assertNotNull("response cannot be null", response);
       }
}