Share this page

# POST: Create a comment

This topic provides instructions for using the POST operation to add a comment.

In this topic:

## 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`

Back to top

## Example

The following example shows how to add a comment to a defect with ID 1048.

    *** 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
    }

Back to top

See also:

- GET: Read a comment
- Attachments

https://admhelp.microfocus.com Software Delivery Management 8942
Tips to improve your search results... OpenText™ Software Delivery Management Help Center OpenText™ Software Delivery Management Help 26.1 All View Local Help Center View Online Help Center Version: