Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Show internal comments usind API

soft_licenses@boxberry.ru
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 22, 2021

I have jira server version 8.17.0 How can I filter the internal comments of the ticket using the API? I found a solution for API v3. But as far as I understand api v3 is only available for Jira Cloud.

2 answers

0 votes
PD Sheehan
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.
November 22, 2021

You would have to call the Comment Property api looking for the property key "sd.public.comment" for each comment and filter them in your client application.

0 votes
Tuncay Senturk _Snapbytes_
Community Champion
November 22, 2021

Hi soft_licenses@boxberry.ru 

Welcome to the community.

What do you mean by internal comments? Are they the internal comments made by JSM agents or any restricted comments in JSW?

soft_licenses@boxberry.ru
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 22, 2021

I want to filter out comments that look like this

image.png

Tuncay Senturk _Snapbytes_
Community Champion
November 23, 2021

OK, those are the JSM agents' internal comments.

To filter those comments, you can use JSM API's service. 

https://docs.atlassian.com/jira-servicedesk/3.7.1/index.html?com/atlassian/servicedesk/api/comment/ServiceDeskCommentService.html

ServiceDeskCommentService commentService = ComponentAccessor.getOSGiComponentInstanceOfType(ServiceDeskCommentService.class);
CommentManager commentManager = ComponentAccessor.getCommentManager();
List<Comment> comments = commentManager.getComments(issue);

iterate the comments and fetch JSM comment by using the service

commentService.getServiceDeskCommentByJiraComment

and use !comment.isPublic() to get internal comments.

I hope I was clear

PD Sheehan
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.
November 23, 2021

@Tuncay Senturk _Snapbytes_ I think he's asking about REST API.

And by definition, the service desk rest API will not include any internal comments.

While the jira internal api will include ALL comments. Hence my suggestion to look directly into the comment property.

I guess the other option is to get ALL core comments from an issue and subtract from the list all JSM comments from the corresponding request.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events