Create Task Comment REST userId is null

I have a custom react js application using pure REST to speak to camunda. I create a task comment using POST /task/{id}/comment/create. When doing so, the userId field in the response, and subsequent GETs to retrieve that comment, show the userId as null. Is there a way to specify this userId using pure REST?

The Tasklist webapp appears to accomplish this, though looking at its network calls it uses the same POST route, so I’d imagine there’s something fancier going on there that I am missing.

The user id is always set to the currently authenticated user. If you use the REST API without authentication, the user id iwll be null. It is not possible to specify a user id in another way.

2 Likes

Understood, thank you for clarifying, Thorben

Thanks Thorben.
However, there are cases where BPMN engine is used as a service without managing user IDs and logins. It would be great if there was an option in the API to specify the user ID submitting the comments. Same way how the API allows to claim a task by user defined in a Post body.

3 Likes

Hi Thorben,

Will something like this work?

identityService.setAuthenticatedUserId(userId);
taskService.createComment(taskId, processInstanceId, message);
identityService.setAuthenticatedUserId(null);