Post an internal comment using v3 API

Hi

I cannot get an example of posting an internal comment to an issue using the v3 Rest API

Hi @CyberlogicIntegratio and welcome to our community!

For a Jira Software project, you can add a comment with a restricted visibility using a project role.
In this example, I’m using a role called TestRole:

{
  "visibility": {
    "type": "role",
    "value": "TestRole"
  },
  "body": {
    "type": "doc",
    "version": 1,
    "content": [
      {
        "type": "paragraph",
        "content": [
          {
            "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.",
            "type": "text"
          }
        ]
      }
    ]
  }
}

And the resulting comment will be restricted to that role:

For a Jira Service project, you can either use the Jira platform /rest/api/3/issue/{issueIdOrKey}/comment end point (link to doc) or the Jira service /rest/servicedeskapi/request/{issueIdOrKey}/comment one (link to doc).
Depending on the end point, the payload will be different.

When using the /rest/api/3/issue/{issueIdOrKey}/comment platform end point, the internal visibility is defined setting the sd.public.comment property in the payload like in this example:

{
  "body": {
    "type": "doc",
    "version": 1,
    "content": [
      {
        "type": "paragraph",
        "content": [
          {
            "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.",
            "type": "text"
          }
        ]
      }
    ]
  },
  "properties": [
       {
         "key": "sd.public.comment",
         "value": {
           "internal": true
         }
       }
     ]
}'

For the /rest/servicedeskapi/request/{issueIdOrKey}/comment service end point, a public boolean parameter is available to control the comment visibility.
Here is an example:

{
  "public": false,
  "body": "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."
}

In both cases, this is how the comment will look like in the user interface:

Hope this helps,
Caterina

1 Like