This resource represents issue comments. Use it to:

  • get, create, update, and delete a comment from an issue.
  • get all comments from issue.
  • get a list of comments by comment ID.

Hierarchy

  • CommonHttpService
    • IssueCommentsService

Constructors

  • Internal

    Create a new instance of the service.

    Parameters

    • getClientInstance: (() => CommonHttpClient)
        • (): CommonHttpClient
        • Returns CommonHttpClient

    Returns IssueCommentsService

Methods

  • Adds a comment to an issue.

    This operation can be accessed anonymously.

    Permissions required:

    • Browse projects and Add comments project permission for the project that the issue containing the comment is in.
    • If issue-level security is configured, issue-level security permission to view the issue.

    Parameters

    • params: {
          comment: Comment;
          expand?: string;
          issueIdOrKey: string;
      }
      • comment: Comment
      • Optionalexpand?: string

        Use expand to include additional information about comments in the response. This parameter accepts renderedBody, which returns the comment body rendered in HTML.

      • issueIdOrKey: string

        The ID or key of the issue.

    Returns Promise<Comment>

    Returned if the request is successful.

    example:

    {
    "author": {
    "accountId": "5b10a2844c20165700ede21g",
    "active": false,
    "displayName": "Mia Krystof",
    "self": "https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10a2844c20165700ede21g"
    },
    "body": {
    "type": "doc",
    "version": 1,
    "content": [
    {
    "type": "paragraph",
    "content": [
    {
    "type": "text",
    "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper."
    }
    ]
    }
    ]
    },
    "created": "2021-01-17T12:34:00.000+0000",
    "id": "10000",
    "self": "https://your-domain.atlassian.net/rest/api/3/issue/10010/comment/10000",
    "updateAuthor": {
    "accountId": "5b10a2844c20165700ede21g",
    "active": false,
    "displayName": "Mia Krystof",
    "self": "https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10a2844c20165700ede21g"
    },
    "updated": "2021-01-18T23:45:00.000+0000",
    "visibility": {
    "identifier": "Administrators",
    "type": "role",
    "value": "Administrators"
    }
    }

    POST /rest/api/3/issue/{issueIdOrKey}/comment @scopes-current write:jira-work @scopes-beta read:comment:jira, read:comment.property:jira, read:group:jira, read:project:jira, read:project-role:jira, read:user:jira, write:comment:jira, read:avatar:jira

  • Returns a comment.

    This operation can be accessed anonymously.

    Permissions required:

    • Browse projects project permission for the project containing the comment.
    • If issue-level security is configured, issue-level security permission to view the issue.
    • If the comment has visibility restrictions, the user belongs to the group or has the role visibility is restricted to.

    Parameters

    • params: {
          expand?: string;
          id: string;
          issueIdOrKey: string;
      }
      • Optionalexpand?: string

        Use expand to include additional information about comments in the response. This parameter accepts renderedBody, which returns the comment body rendered in HTML.

      • id: string

        The ID of the comment.

      • issueIdOrKey: string

        The ID or key of the issue.

    Returns Promise<Comment>

    Returned if the request is successful.

    example:

    {
    "author": {
    "accountId": "5b10a2844c20165700ede21g",
    "active": false,
    "displayName": "Mia Krystof",
    "self": "https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10a2844c20165700ede21g"
    },
    "body": {
    "type": "doc",
    "version": 1,
    "content": [
    {
    "type": "paragraph",
    "content": [
    {
    "type": "text",
    "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper."
    }
    ]
    }
    ]
    },
    "created": "2021-01-17T12:34:00.000+0000",
    "id": "10000",
    "self": "https://your-domain.atlassian.net/rest/api/3/issue/10010/comment/10000",
    "updateAuthor": {
    "accountId": "5b10a2844c20165700ede21g",
    "active": false,
    "displayName": "Mia Krystof",
    "self": "https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10a2844c20165700ede21g"
    },
    "updated": "2021-01-18T23:45:00.000+0000",
    "visibility": {
    "identifier": "Administrators",
    "type": "role",
    "value": "Administrators"
    }
    }

    GET /rest/api/3/issue/{issueIdOrKey}/comment/{id} @scopes-current read:jira-work @scopes-beta read:comment:jira, read:comment.property:jira, read:group:jira, read:project:jira, read:project-role:jira, read:user:jira, read:avatar:jira

  • Returns all comments for an issue.

    This operation can be accessed anonymously.

    Permissions required: Comments are included in the response where the user has:

    • Browse projects project permission for the project containing the comment.
    • If issue-level security is configured, issue-level security permission to view the issue.
    • If the comment has visibility restrictions, belongs to the group or has the role visibility is role visibility is restricted to.

    Parameters

    • params: {
          expand?: string;
          issueIdOrKey: string;
          maxResults?: number;
          orderBy?: "created" | "-created" | "+created";
          startAt?: number;
      }
      • Optionalexpand?: string

        Use expand to include additional information about comments in the response. This parameter accepts renderedBody, which returns the comment body rendered in HTML.

      • issueIdOrKey: string

        The ID or key of the issue.

      • OptionalmaxResults?: number

        The maximum number of items to return per page.

      • OptionalorderBy?: "created" | "-created" | "+created"

        Order the results by a field. Accepts created to sort comments by their created date.

      • OptionalstartAt?: number

        The index of the first item to return in a page of results (page offset).

    Returns Promise<PageOfComments>

    Returned if the request is successful.

    example:

    {
    "comments": [
    {
    "author": {
    "accountId": "5b10a2844c20165700ede21g",
    "active": false,
    "displayName": "Mia Krystof",
    "self": "https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10a2844c20165700ede21g"
    },
    "body": {
    "type": "doc",
    "version": 1,
    "content": [
    {
    "type": "paragraph",
    "content": [
    {
    "type": "text",
    "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper."
    }
    ]
    }
    ]
    },
    "created": "2021-01-17T12:34:00.000+0000",
    "id": "10000",
    "self": "https://your-domain.atlassian.net/rest/api/3/issue/10010/comment/10000",
    "updateAuthor": {
    "accountId": "5b10a2844c20165700ede21g",
    "active": false,
    "displayName": "Mia Krystof",
    "self": "https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10a2844c20165700ede21g"
    },
    "updated": "2021-01-18T23:45:00.000+0000",
    "visibility": {
    "identifier": "Administrators",
    "type": "role",
    "value": "Administrators"
    }
    }
    ],
    "maxResults": 1,
    "startAt": 0,
    "total": 1
    }

    GET /rest/api/3/issue/{issueIdOrKey}/comment @scopes-current read:jira-work @scopes-beta read:comment:jira, read:comment.property:jira, read:group:jira, read:project:jira, read:project-role:jira, read:user:jira, read:avatar:jira

  • Returns a paginated list of comments specified by a list of comment IDs.

    This operation can be accessed anonymously.

    Permissions required: Comments are returned where the user:

    • has Browse projects project permission for the project containing the comment.
    • If issue-level security is configured, issue-level security permission to view the issue.
    • If the comment has visibility restrictions, belongs to the group or has the role visibility is restricted to.

    Parameters

    • params: {
          expand?: string;
          issueCommentListRequestBean: IssueCommentListRequestBean;
      }
      • Optionalexpand?: string

        Use expand to include additional information about comments in the response. This parameter accepts a comma-separated list. Expand options include:

        • renderedBody Returns the comment body rendered in HTML.
        • properties Returns the comment's properties.
      • issueCommentListRequestBean: IssueCommentListRequestBean

        The list of comment IDs.

    Returns Promise<PageBeanComment>

    Returned if the request is successful.

    example:

    {
    "isLast": true,
    "maxResults": 1048576,
    "startAt": 0,
    "total": 1,
    "values": [
    {
    "author": {
    "accountId": "5b10a2844c20165700ede21g",
    "active": false,
    "displayName": "Mia Krystof",
    "self": "https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10a2844c20165700ede21g"
    },
    "body": {
    "type": "doc",
    "version": 1,
    "content": [
    {
    "type": "paragraph",
    "content": [
    {
    "type": "text",
    "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper."
    }
    ]
    }
    ]
    },
    "created": "2021-01-17T12:34:00.000+0000",
    "id": "10000",
    "self": "https://your-domain.atlassian.net/rest/api/3/issue/10010/comment/10000",
    "updateAuthor": {
    "accountId": "5b10a2844c20165700ede21g",
    "active": false,
    "displayName": "Mia Krystof",
    "self": "https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10a2844c20165700ede21g"
    },
    "updated": "2021-01-18T23:45:00.000+0000",
    "visibility": {
    "identifier": "Administrators",
    "type": "role",
    "value": "Administrators"
    }
    }
    ]
    }

    POST /rest/api/3/comment/list @scopes-current read:jira-work @scopes-beta delete:comment.property:jira, read:avatar:jira, read:comment:jira, read:group:jira, read:project-role:jira, read:user:jira, read:comment.property:jira, read:project:jira

  • Updates a comment.

    This operation can be accessed anonymously.

    Permissions required:

    • Browse projects project permission for the project that the issue containing the comment is in.
    • If issue-level security is configured, issue-level security permission to view the issue.
    • Edit all comments project permission to update any comment or Edit own comments to update comment created by the user.
    • If the comment has visibility restrictions, the user belongs to the group or has the role visibility is restricted to.

    Parameters

    • params: {
          comment: Comment;
          expand?: string;
          id: string;
          issueIdOrKey: string;
          notifyUsers?: boolean;
          overrideEditableFlag?: boolean;
      }
      • comment: Comment
      • Optionalexpand?: string

        Use expand to include additional information about comments in the response. This parameter accepts renderedBody, which returns the comment body rendered in HTML.

      • id: string

        The ID of the comment.

      • issueIdOrKey: string

        The ID or key of the issue.

      • OptionalnotifyUsers?: boolean

        Whether users are notified when a comment is updated.

      • OptionaloverrideEditableFlag?: boolean

        Whether screen security is overridden to enable uneditable fields to be edited. Available to Connect app users with the Administer Jira global permission and Forge apps acting on behalf of users with Administer Jira global permission.

    Returns Promise<Comment>

    Returned if the request is successful.

    example:

    {
    "author": {
    "accountId": "5b10a2844c20165700ede21g",
    "active": false,
    "displayName": "Mia Krystof",
    "self": "https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10a2844c20165700ede21g"
    },
    "body": {
    "type": "doc",
    "version": 1,
    "content": [
    {
    "type": "paragraph",
    "content": [
    {
    "type": "text",
    "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper."
    }
    ]
    }
    ]
    },
    "created": "2021-01-17T12:34:00.000+0000",
    "id": "10000",
    "self": "https://your-domain.atlassian.net/rest/api/3/issue/10010/comment/10000",
    "updateAuthor": {
    "accountId": "5b10a2844c20165700ede21g",
    "active": false,
    "displayName": "Mia Krystof",
    "self": "https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10a2844c20165700ede21g"
    },
    "updated": "2021-01-18T23:45:00.000+0000",
    "visibility": {
    "identifier": "Administrators",
    "type": "role",
    "value": "Administrators"
    }
    }

    PUT /rest/api/3/issue/{issueIdOrKey}/comment/{id} @scopes-current write:jira-work @scopes-beta read:comment:jira, read:comment.property:jira, read:group:jira, read:project:jira, read:project-role:jira, read:user:jira, write:comment:jira, read:avatar:jira

  • Method to initialize the class. Normally used to set up validation rules.

    Returns void