Create Internal Comment using REST API for Jira Service Desk Server

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.

2 answers

0 votes

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

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.

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?

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

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

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.

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. 

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

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.

Thanks to @Alexey Matveev [cPrime] 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?

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

I posted the request I am making above in reply to @Alexey Matveev [cPrime] 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?

Suggest an answer

Log in or Sign up to answer
Community showcase
Asked Dec 06, 2018 in Jira Service Desk

Looking for teams who switched from email to Jira Service Desk

The Jira Service Desk marketing team is working on a guide to help new Atlassian customers switch from email to JSD and we'd love to hear from you! Please share: - What made you realize that i...

711 views 5 8
View question

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you