Forums

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

How do we get the comment visibility in the comment section, from the JIRA module provided in python

Mahalakshmi Ullas
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!
January 13, 2023

Hi, 

I am trying to get the comment visibility of each comment in the comment section of the issue/ticket from the JIRA module provided in Python. 

for example: author = jira.comment.author.displayName
time = jira.comment.created

like wise is there any method to get the visibility of each comment

Thanks in advance. 

1 answer

0 votes
Darin February 9, 2023

Hi @Mahalakshmi Ullas are you calling Jira API directly in Python? Thanks

Darin February 10, 2023

Not sure how by using that "Jira module for python". I assume you are referring to this: https://pypi.org/project/jira/

I don't see an example in their docs about getting what you want. 

I never use that library. It's for people who don't want to do the work and who do not want the full spectrum of what the real Jira APIs provide.

If you know Python and APIs, you don't need that module.

Do this instead:

https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/#api/2/issue-getComments

  • GET /rest/api/2/issue/{issueIdOrKey}/comment

returns the author, the time, the content, visibility

{
"startAt": 0,
"maxResults": 1,
"total": 1,
"comments": [
{
"self": "http://www.example.com/jira/rest/api/2/issue/10010/comment/10000",
"id": "10000",
"author": {
"self": "http://www.example.com/jira/rest/api/2/user?username=fred",
"name": "fred",
"displayName": "Fred F. User",
"active": 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.",
"updateAuthor": {
"self": "http://www.example.com/jira/rest/api/2/user?username=fred",
"name": "fred",
"displayName": "Fred F. User",
"active": false
},
"created": "2017-12-07T09:23:19.175+0000",
"updated": "2017-12-07T09:23:19.175+0000",
"visibility": {
"type": "role",
"value": "Administrators"
}
}
]
}

Suggest an answer

Log in or Sign up to answer