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

Back to top

## Examples

Example for getting 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
    }

Example of getting 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
    }

Back to top

https://admhelp.microfocus.com ALM Octane 8942
Tips to improve your search results... ALM Octane Help Center ALM Octane Help 23.4-24.3 All View Local Help Center View Online Help Center Version: