Share this page

# GET: Read a comment

This topic provides instructions for using the GET operation to read a comment.

In this topic:

## Overview

The comment instance is represented by data in JSON format.

To get the entity ID, first read all instances and locate the desired entity.

Note: When getting instances, the REST API does not necessarily display all fields for the instance. For a complete list of available fields, see Retrieve metadata.

For performance optimization, when getting entities, comments are not included in the response. To see 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

The following examples show how to use the GET operation to read comments.

### Get references to all the comments for all defects

`GET .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/defects/?fields=comments`

*** Response ***

    {
      "total_count": 2,
      "data": [
        {
          "type": "defect",
          "logical_name": "gp6l86wdj0q42axrddgzjy5n4",
          "comments": {
            "total_count": 1,
            "data": [
              {
                "type": "comment",
                "id": "1002"
              }
            ]
          },
          "id": "1099"
        },
        {
          "type": "defect",
          "logical_name": "p9w6e0p42q0ooh55q592vy2j1",
          "comments": {
            "total_count": 1,
            "data": [
              {
                "type": "comment",
                "id": "1001"
              }
            ]
          },
          "id": "1070"
        }
      ],
      "exceeds_total_count": false
    }

### Get all comments for a specific defect

This example gets all comments of a specific defect 1104 by querying the comments entity and filtering by owner_work_item.

    GET .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/comments?query="owner_work_item EQ {id EQ  ^1104^}"

    *** Response ***

    {
      "total_count": 2,
      "data": [
        {
          "type": "comment",
          "creation_time": "2016-11-01T15:52:57Z",
          "version_stamp": 1,
          "author": {
            "type": "workspace_user",
            "full_name": "user@company",
            "name": "user@company",
            "id": "1001"
          },
          "id": "1004",
          "text": "<html><body>\n<p>This is a comment for defect 1104.</p> \n</body></html>",
          "last_modified": "2016-11-01T15:52:57Z"
        },
        {
          "type": "comment",
          "creation_time": "2016-11-01T15:53:07Z",
          "version_stamp": 1,
          "author": {
            "type": "workspace_user",
            "full_name": "user@company",
            "name": "user@company",
            "id": "1001"
          },
          "id": "1005",
          "text": "<html><body>\n<p>This is a second comment for defect 1104.</p> \n</body></html>",
          "last_modified": "2016-11-01T15:53:07Z"
        }
      ],
      "exceeds_total_count": false
    }

## See also

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.3 All View Local Help Center View Online Help Center Version: