I'm beginner in Camunda. I would like to complete a task. So I start an instance by calling :
http://localhost:8080/engine-rest/process-definition/key/approve-loan/submit-form
via Postman and POST request with following data :
{
"variables": {
"customerId": {"value":"Niall","type":"String"},
"amount":{"value":"100","type":"String"}
}
}
and Content-Type : application/json
I have the following output :
{
"links": [
{
"method": "GET",
"href": "http://localhost:8080/engine-rest/process-instance/3f219a2a-138e-11e7-b49e-104a7ddf1366",
"rel": "self"
}
],
"id": "3f219a2a-138e-11e7-b49e-104a7ddf1366",
"definitionId": "approve-loan:2:8cd1ab3c-1303-11e7-b49e-104a7ddf1366",
"businessKey": null,
"caseInstanceId": null,
"ended": false,
"suspended": false,
"tenantId": null
}
I looked in the camunda blog and I found I can complete the task instance by calling (POST request):
http://localhost:8080/engine-rest/task/3f219a2a-138e-11e7-b49e-104a7ddf1366/complete
The problem is that's not working since I have the following response :
{
"type": "RestException",
"message": "Cannot complete task 3f219a2a-138e-11e7-b49e-104a7ddf1366: Cannot find task with id 3f219a2a-138e-11e7-b49e-104a7ddf1366: task is null"
}
and this exception in tomcat console :
Caused by: org.camunda.bpm.engine.exception.NullValueException: Cannot find task with id 3f219a2a-138e-11e7-b49e-104a7ddf1366: task is null
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.camunda.bpm.engine.impl.util.EnsureUtil.generateException(EnsureUtil.java:334)
at org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotNull(EnsureUtil.java:49)
at org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotNull(EnsureUtil.java:44)
at org.camunda.bpm.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:47)
at org.camunda.bpm.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:30)
at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:104)
at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:66)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
at org.camunda.bpm.engine.impl.TaskServiceImpl.complete(TaskServiceImpl.java:170)
at org.camunda.bpm.engine.rest.sub.task.impl.TaskResourceImpl.complete(TaskResourceImpl.java:95)
... 37 more
I have called http://localhost:8080/engine-rest/task/?processInstanceId=3f219a2a-138e-11e7-b49e-104a7ddf1366
to get properties and the response is
[
{
"id": "3f220f63-138e-11e7-b49e-104a7ddf1366",
"name": "Approve Loan",
"assignee": "john",
"created": "2017-03-28T10:12:12",
"due": null,
"followUp": null,
"delegationState": null,
"description": null,
"executionId": "3f219a2a-138e-11e7-b49e-104a7ddf1366",
"owner": null,
"parentTaskId": null,
"priority": 50,
"processDefinitionId": "approve-loan:2:8cd1ab3c-1303-11e7-b49e-104a7ddf1366",
"processInstanceId": "3f219a2a-138e-11e7-b49e-104a7ddf1366",
"taskDefinitionKey": "UserTask_11fud4o",
"caseExecutionId": null,
"caseInstanceId": null,
"caseDefinitionId": null,
"suspended": false,
"formKey": "embedded:app:forms/approve-loan.html",
"tenantId": null
}
]
I have used id
and executionId
but I still get the error.
Any help please ?
Thanks to @Zelldon : The working URL is http://localhost:8080/engine-rest/task/3f220f63-138e-11e7-b49e-104a7ddf1366/complete
I just have to take the id from the response got after the call of http://localhost:8080/engine-rest/task/?processInstanceId=3f219a2a-138e-11e7-b49e-104a7ddf1366
Please mark it as resolved since I can't.