# Get Comments

### Overview

Return existing comments for the given entity ID.

### API URI

```bash
GET: /entities/{entityTypeId}/{entityId}/comments?projectId={projectId}&startIndex=<startIndex>&maxResults=<maxResults>&nextPageLink=<nextPageLink>&afterTime=<afterTime>
```

### URI Parameters

| **Name**     | **In** | **Required** | **Type** | **Description**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ------------ | ------ | ------------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| entityTypeId | path   | True         | String   | `id` of entity type for given entityId                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| entityId     | path   | True         | String   | `id` of entity for which comments need to be returned                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| projectId    | query  | True         | String   | Project in which the given entity exists                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| startIndex   | query  | True         | Integer  | Start index from which comments need to be returned                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| maxResults   | query  | True         | Integer  | Number of comments from `startIndex` that need to be returned                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| nextPageLink | query  | False        | String   | Link to the next page if returned by the end system                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| afterTime    | query  | False        | String   | <p>Time after which the comments are to be filtered.<br><br>The <code>afterTime</code> date format will be the same as provided in <a href="/pages/5Dx7krhPfLxKrqbiBJ8a#response-payload"><code>comments.createUpdateDateFormat</code> in response payload for Entity Type – Get API</a>, and <code>timeZone</code> will be the same as provided in <a href="/pages/QK4rd6L7c9JicvXDly6c#response-payload"><code>timeZone</code> in response payload for Server-Info API</a>.<br><br>- If the end system API does not support time-based filtering on comments, this parameter may be ignored.<br>- If the end system API supports time-based filtering on comments, the connector should return the comments with a createdUpdatedTime greater than the specified afterTime.<br>- If “null” is passed in the “afterTime” then connector needs to return all the comments without any time filter applied.</p> |

### Response Payload

```json
{
  "nextPageLink": "// Link to the next page if returned by the end system",
  "nextPageLinkSupported": "true/false | datatype: boolean",
  "comments": [
    {
      "<idField>": "",
      "<titleField>": "",
      "<bodyField>": "",
      "<createdByField>": "",
      "<createdDateField>": "",
      "<updatedByField>": "",
      "<updatedDateField>": "",
      "<commentTypeField>": ""
    }
  ]
}
```

> **Note**": The key names in the above JSON will be as per the comment field names in your connector.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://opstech.gitbook.io/opstech-docs/connector-sdk-index/sdk-connector-apis/get-comments.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
