Developer Portal for YouTrack and Hub Help

Operations with Specific IssueComment

This resource lets you work with comments of an issue.

Resource

/api/issues/{issueID}/comments/{commentID}

Returned entity

IssueComment. For the description of the entity attributes, see Supported Fields section.

Supported methods

IssueComment attributes

Represents an existing issue comment.

Related Resources

Below you can find the list of resources that let you work with this entity.

Attributes

This table describes attributes of the IssueComment entity.

  • To receive an attribute in the response from the server, specify it explicitly in the fields request parameter.

  • To update an attribute, provide it in the body of a POST request.

Field

Type

Description

id

String

The ID of the vote for the duplicate issue. Read-only.

attachments

Array of IssueAttachments

The list of attachments that are attached to the comment.

author

User

The user who created the comment. Read-only. Can be null.

created

Long

The timestamp in milliseconds indicating the moment the comment was posted. Stored as a unix timestamp at UTC. Read-only. Can be null.

deleted

Boolean

When true, the comment is considered to be deleted, otherwise false.

issue

Issue

The issue the comment belongs to. Read-only. Can be null.

pinned

Boolean

Determines whether the comment is pinned in the issue.

reactions

Array of Reactions

The list of reactions that users added to this comment.

text

String

The text of the comment. Can be null.

textPreview

String

The comment text as it is shown in UI after processing with wiki/markdown (including HTML markup). Read-only.

updated

Long

The timestamp in milliseconds indicating the last update of the comment. Stored as a unix timestamp at UTC. Read-only. Can be null.

visibility

Visibility

Visibility settings of the comment. They define who is allowed to see the comment. Can be null.

Read a Specific IssueComment

Read a comment with a specific ID.

Required permissions

Requires read access to the issue. If a user is the comment author, the comment is always visible.

Request syntax

GET /api/issues/{issueID}/comments/{commentID}?{fields}

{commentID}

Database ID of the comment.

Request parameters

Parameter

Type

Description

fields

String

A list of IssueComment attributes that should be returned in the response. If no field is specified, only the entityID is returned.

Sample

Sample request

https://example.youtrack.cloud/api/issues/2-33/comments/4-17?fields=id,created,author(name,id),text

Sample response body

{ "author": { "name": "John Doe", "id": "1-2", "$type": "User" }, "created": 1569502774166, "text": "Uh, Houston, we've definitely had a problem.", "id": "4-17", "$type": "IssueComment" }

Update a Specific IssueComment

Update an existing comment of the specific issue.

Required permissions

Requires Update Comment permission for own comments and Update Not Own Comment permission for not own comments.

Request syntax

POST /api/issues/{issueID}/comments/{commentID}?{fields}&{muteUpdateNotifications}

{commentID}

Database ID of the comment.

Request parameters

Parameter

Type

Description

fields

String

A list of IssueComment attributes that should be returned in the response. If no field is specified, only the entityID is returned.

muteUpdateNotifications

Boolean

Set this parameter to true if no notifications should be sent on changes made by this request. This doesn't mute notifications sent by any workflow rules. Using this parameter requires Apply Commands Silently permission in all projects affected by the request. Available since 2021.3.

Sample 1

Sample request

https://example.youtrack.cloud/api/issues/2-31/comments/4-2/?fields=id,author(login,name,id),deleted,text,updated,visibility(permittedGroups(name,id),permittedUsers(id,name,login))

Sample request body

{ "text": "okay, let's do it, @jane.doe. By the way, I'm updating this comment using REST.", "visibility": { "permittedGroups":[{"id":"3-2"}], "$type": "LimitedVisibility" } }

Sample response body

{ "deleted": false, "author": { "login": "john.doe", "name": "John Doe", "id": "1-2" }, "visibility": { "permittedUsers": [], "permittedGroups": [ { "name": "Sample Project Team", "id": "3-2" } ], "$type": "LimitedVisibility" }, "text": "okay, let's do it, @jane.doe. By the way, I'm updating this comment using REST.", "updated": 1535542466727, "id": "4-2" }

Sample 2

Let's update the deleted attribute of a comment to remove this comment from the issue temporarily. This means that the comment can be restored later if necessary. To delete a comment permanently, use the DELETE request.

Sample request

https://example.youtrack.cloud/api/issues/2-31/comments/4-2/?fields=id,text,deleted

Sample request body

{ "deleted": true }

Sample response body

{ "deleted": true, "text": "@Jane.Doe, please take care of this task", "id": "4-2", "$type": "IssueComment" }

Delete a Specific IssueComment

Delete an existing comment of the specific issue. This request deletes a comment from the database completely. You can also remove a comment from an issue temporarily by updating the comment. For details, check the request sample.

Required permissions

Requires Delete Comment permission for own comments and Delete Not Own Comment permission for not own comments.

Request syntax

DELETE /api/issues/{issueID}/comments/{commentID}

{commentID}

Database ID of the comment.

Request parameters

Parameter

Type

Description

fields

String

A list of IssueComment attributes that should be returned in the response. If no field is specified, only the entityID is returned.

Sample

Sample request

https://example.youtrack.cloud/api/issues/2-7/comments/4-5
Last modified: 7 November 2024