Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Create Internal Comment using REST API for Jira Service Desk Server

Matt Weick July 31, 2018

Trying to create an internal comment on an issue using the REST API. We use Jira Service Desk Server version 7.7.0

I have tried sending the body JSON format below and can't get this to work...

{
"body": "Test internal comment",
"properties": {
"key": "sd.public.comment",
"value": {
"internal": true
}
}
}

 

Sending the POST request without the "properties" key/value add's the comment to the issue no problems but it is a public comment.

Any help on this would be appreciated, thank you.

3 answers

5 votes
Ramesh Rakshe April 26, 2022

Hi @Matt Weick You can use same API to post internal comment on issue. Just wrap "properties" in array node. Refer below code snippet.

{
"body": "Test internal comment",
"properties": [
{
"key": "sd.public.comment",
"value": {
"internal": true
}
}
]
}
Ralph Gerald Varon June 1, 2023

Awesome! This one worked.

0 votes
Michał Sztuka August 1, 2018

Hello,

As described in documentation, You need to make a POST method call to the endpoint /rest/servicedeskapi/request/{issueIdOrKey}/comment with a body like: 

{ "body": "Hello there", "public": true }

 To make an internal comment just change the value of public property to false like here:

{ "body": "Hello there", "public": false}

It worked in my case, I hope that it will be the same in your case.

Matt Weick August 1, 2018

Thanks to @Alexey Matveev with the API Browser, I was able to see that the "/rest/servicedeskapi/" methods are Private REST APIs only. I am trying to make the call from a different application, this would explain why I am getting 404 not found. 

Is there a way to make POST "/rest/servicedeskapi/request/{issueIdOrKey}/comment" a public API?

Michał Sztuka August 1, 2018

Status 404 is returned if the customer request does not exist, maybe it is a cause..

Matt Weick August 1, 2018

I posted the request I am making above in reply to @Alexey Matveev above. I believe I have figured this out though, it appears that if the Issue does not have a "Request Type" selected, the API calls won't work. I just defined a "Request Type" for the Issue I was testing with and it added the internal comment on the Issue via the REST call.

Some Issues that we have might not have a Request Type defined on the Issue, do you know if it's possible for this to work without having a Request Type selected on an issue?

Like Sandy Duchemin likes this
samitha December 9, 2019

Hi, got a doubt here..
Is it sure that if the issue does not have a "Request Type" selected, the API calls won't work and internal comments can't be created?

0 votes
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 31, 2018

Hello,

Try to use ServiceDesk Rest Api for it. You can find more info here:

https://developer.atlassian.com/cloud/jira/service-desk/rest/#api-request-issueIdOrKey-comment-post

Matt Weick August 1, 2018

We have the server edition of Jira Service Desk (we host it in our data center), the doc you reference here I believe is only for the cloud edition of Service Desk because I already tried that before posting this and the response is always 404 not found.

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 1, 2018
Matt Weick August 1, 2018

Still getting 404 not found when trying "https://servicedesk.company.com/rest/servicedeskapi/request/ISSUE-#/comment"

The "/rest/api/" and "/rest/api/2/" methods all work but can't figure out how to set them as internal comments. Do I have install/enable something in order to get "/rest/servicedeskapi/" methods to function?

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 1, 2018

You can install the Rest Api Browser. It will help you to work with Rest Api, which is available in Jira. It is a free add-on. 

https://marketplace.atlassian.com/apps/1211542/atlassian-rest-api-browser

Matt Weick August 1, 2018

Does this include the "/rest/servicedeskapi/" methods ?

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 1, 2018

It will let you see all rest api methods you have in your Jira. /rest/servicedeskapi is installed with Jira Service Desk. If you have the Jira Service Desk application installed, then the rest api is there. You can find it with the Rest Api Browser.

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 1, 2018

Private and Public does not matter. It is still can be called from outside. It means you are doing the wrong call from your external application. 

Matt Weick August 1, 2018

This is the exact call I am making:

POST  https://support.domain.com/rest/servicedeskapi/request/ISSUE-100/comment

JSON Body:

{
"body": "Test internal comment",
"public": false
}

 This returns a 404

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events