Creates a comment for a task by id.

Method

POST /task/{id}/comment/create

Parameters

Path Parameters

Name Description
id The id of the task to add the comment to.

Request Body

A JSON object with the following properties:

Name Description
message The message of the task comment to create. Has to be of type String.

Result

A JSON object representing the newly created comment. Its structure corresponds to the Comment interface in the engine.Its properties are as follows:

Name Value Description
id String The id of the task comment.
userId String The id of the user who created the comment.
taskId String The id of the task to which the comment belongs.
time Date The time when the comment was created.
message String The content of the comment.
links List Link to the newly created task comment with method, href and rel.

Response Codes

Code Media type Description
200 application/json Request successful.
400 application/json The task does not exist or no comment message was submitted. See the Introduction for the error response format.
403 application/json The history of the engine is disabled. See the Introduction for the error response format.

Example

Request

Post data for a new task comment:

POST /task/aTaskId/comment/create

  1. {"message": "a task comment"}

Response

Status 200.

  1. {
  2. "links": [
  3. {
  4. "method": "GET",
  5. "href": "http://localhost:38080/rest-test/task/aTaskId/comment/aTaskCommentId",
  6. "rel": "self"
  7. }
  8. ],
  9. "id": "aTaskCommentId",
  10. "userId": "userId",
  11. "taskId": "aTaskId",
  12. "time": "2013-01-02T21:37:03.887+0200",
  13. "message": "comment message"
  14. }

原文: https://docs.camunda.org/manual/7.9/reference/rest/task/comment/post-task-comment/