POST: Create a comment
This topic provides instructions for using the POST operation to add a comment.
Overview
To create a comment instance, perform a POST on the comment collection, passing a JSON string. When posting the comment, you assign the comment to an instance, such as a defect.
Even though a comment is a field of an entity, you create the comment and assign it to the entity. You do not create the entity and add a comment to it.
Bulk POSTs are not supported.
Show comments
For performance optimization, when getting other entities, comments are not included by default in the response. To show a list of comment IDs and types, you have to explicitly request them using the fields clause.
GET .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/defects&fields=comments
Examples
*** Request ***
POST .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/comments
{
"data": [
{ "author":
{ "id":"1001",
"type":"workspace_user"
},
"text":"my new comment",
"owner_work_item":
{
"id":"1024",
"type":"defect"
}
}
]
}
*** Response ***
{ "total_count": 1, "data": [ { "type": "comment", "id": "1001" } ], "exceeds_total_count": false }
See also: