1
votes

I'm doing performance evaluation Camunda BPM engine 7.2 REST API (I'm using invoice.bpmn as example that comes with prepackaged tomcat distro) and as part of it, I'm doing REST calls to navigate through a deployed process, meaning, I've first Started a process instance with REST call "http://localhost.:8080/engine-rest/process-definition/invoice:1:669071c7-c2bc-11e4-a421-a0d3c11a22ca/submit-form". Now within this instance, I have to choose an "Approver" on the task form (its a drop down with 4 values to choose from) but if I query for task variables, I see only three of the four.

GET: "http://localhost.:8080/engine-rest/task/9cbf77d6-c8ef-11e4-9ab8-a0d3c11a22ca/form-variables" 

Response:

{
    "amount": {
        "type": "String",
        "value": "10$",
        "valueInfo": {}
    },
    "invoiceNumber": {
        "type": "String",
        "value": "J-10002",
        "valueInfo": {}
    },
    "creditor": {
        "type": "String",
        "value": "Jay-Test",
        "valueInfo": {}
    }
}

Now, I have to choose an approver and submit the task form with the REST call. "http://localhost.:8080/engine-rest/task/9cbf77d6-c8ef-11e4-9ab8-a0d3c11a22ca/submit-form" I tried a guess variable name in the json body of the request as below but it didn't work. How do I select a value for "Approver" and complete this task with REST call?

{"approver":"demo"}

I'm following the following REST documentation on camunda.org but haven't got any clue: http://docs.camunda.org/latest/api-references/rest/#process-definition-start-process-instance

1

1 Answers

3
votes

The potential approvers of the process are not part of the task-variables. It's a static list of options which is defined in the task form itself: See the form on Github

In order to complete the task, you have to make a POST request to submit-form with this payload:

{"variables":{"approver":{"value":"demo","type":"String"}}}

as described in the REST API documentation