Complete external-task through JSON

Hi folks,

I developed a bpm which has an external-task. I have to complete the task through application/json.
I read lots of post, examples, and practically the whole camunda documentation but I still struggle with that.
I tried to post an application/json to my TomCat server

http://localhost:8080/engine-rest/external-task/ID_MY_EXTERNAL_TASK/complete

POST application/json (body):
{
“workerId”: “demo”,
}

Unfortunately, I always got the same reply from the server:

{
    "type": "RestException",
    "message": "External Task ID_MY_EXTERNAL_TASK cannot be completed by worker 'demo'. It is locked by worker 'null'."
}

I tried to post a fetchAndLock, but I always received the same answer:

http://localhost:8080/engine-rest/external-task/fetchAndLock/

    {
        "type": "NullValueException",
        "message": "workerId is null"
    }

Please, do you have any clue about what I am doing wrong or if I missed a previous step?
Any kind of information will be appreciate.

Cheers

Antonio.

PS: I uploaded my bpmn in case that it would help.video-publishing.bpmn (8.9 KB)

Hi Antonio,

what payload did you send on the ‘fetchAndLock’ request?

The payload must include the ‘workerId’ (in your case “demo”).

For example:

{
  "workerId":"demo",
  "maxTasks":10,
  "topics":
      [{"topicName": "transcodeVideo",
      "lockDuration": 10000
      }]
}

Please have a look at the docs.

Best regards,
Philipp

Thanks Philipp_Ossler, finally I managed it . Thanks a lot!