Service Desk comment visibility according to REST API?

Philip Colmer
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.
January 23, 2015

The REST API documentation says that when you use GET and PUT, the JSON can contain something like:

"visibility": {
                "type": "role",
                "value": "Administrators"
            }

If I query Service Desk (JIRA) for a comment that was specifically marked as an "Internal comment", however, the JSON does not include this information. Looking at the JSON I get back, there is nothing that indicates that this is a private comment.

What am I misunderstanding here? How can I find out how Service Desk treats internal comments? I'm trying to write an importer and I need to keep private comments as private.

 

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
ian may June 7, 2015

I also needed this. I tried this after reading here. Heres what i tried assuming you know the comment id for the comment in question:

https://YOURJIRASERVER.com/rest/api/2/comment/YOURCOMMENTID/properties/sd.public.comment/

You'll get back something like this if its got a property for the service desk comment.

key                   value
---                   -----
sd.public.comment     @{internal=false}

 

I think you can set this too if thats what you need, but haven't tried myself. For me i'm trying to set the visibility role something private on all comments that are 'Internal' via the servicedesk so i just need to find them!

Hope this gets you a little closer. 

1 vote
ɹǝʞɐq pɐɹq
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 26, 2015

We dont have an API to cover this yet but the JSD code internally uses a "comment JSON property" to indicate the private-ness of comments.

 

 { 

     "internal" : true

}

You need to use the new JIRA entity property code to set comment properties

https://developer.atlassian.com/display/JIRADEV/JIRA+Entity+Properties+Overview

Specifically 

 com.atlassian.jira.entity.property.JsonEntityPropertyManager

like this

 

def setSDCommentProperty(applicationUser: ApplicationUser, comment: Comment) {
jsonEntityPropertyManager.put(applicationUser, "sd.comment.property, comment.getId, "sd.public.comment", "{ "internal" : true}" , null, false)
}

 

In the future we will have an API to do this. Please feel free to contact me directly on brad.baker@atlassian.com for more details if this helps

Marketa Dvorackova April 16, 2015

Hi Brad, thank you for the example of how to setup a property. I would like to ask for help with the opposite - getting the value of this exact property. The problem is that JsonEntityPropertyManager's constructors require other objects which require other objects and so on recursively and I am not capable of delivering them. I am trying to get the value from a groovy script. If you could give me any kind of a hint, I'd be very greatful. Thanks a lot

Dave Seltzer March 29, 2018

Hi @ɹǝʞɐq pɐɹq,

> In the future we will have an API to do this.

It's the future now. 

I'm using the Rest API.

Is there any way to get the full details of a comment (including private-ness) without making a second HTTP request?

Thanks!

-Dave

0 votes
Chris Knight July 28, 2015

Is there any way I can check this value via Script Runner? I'm trying to send a custom email to the reporter when an issue is commented, but only when the comment is external.

Marketa Dvorackova July 28, 2015

That's exactly what I would need too Chris:( never got around with this unfortunately. Guys please, help if you know how to.

Chris Knight July 29, 2015

@Marketa Dvorackova I figured it out here: https://answers.atlassian.com/questions/22654312

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events