Accessing Parent Comment ID using Rest API

Accessing Parent Comment ID using Rest API

Overview

When a reply is created using ThreadWave Comments for JSM, the app stores the parent–child relationship as a Jira comment property.

Each reply comment includes a property with the key:

replyTo

The parent comment ID is stored inside this property under:

value.parent

Top-level comments do not contain this property.

REST API: Retrieve Parent Comment ID

To retrieve the parent comment ID for a reply, use the Jira REST API with the expand=properties parameter.

Endpoint

<Jira base URL>/rest/api/3/issue/{issueIdOrKey}/comment/{commentId}?expand=properties

Example

Sample Response (Relevant Section)

{
"id": "11948",
"properties": [
{
"key": "replyTo",
"value": {
"parent": "11947"
}
}
]
}

How to Identify the Parent Comment

From the response:

  • 11948 → child comment ID

  • 11947 → The parent comment ID

The parent ID is located at:

properties[].value.parent

Where:

properties[].key == "replyTo"

Identifying Whether a Comment Is a Reply

A comment is considered a reply if:

  • The replyTo property exists in the comment properties

  • The value.parent field contains a valid comment ID

If the replyTo property is not present, the comment is a top-level comment.