It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Hi to fetch comment from jira ticket using python code?

Hi,

For my automation work i have to fetch comment from JIRA ticket. Please let me know how to fetch comment from jira ticket.

3 answers

2 accepted

1 vote
Answer accepted

Thank you..i am able to read the description.

Now when new ticket is arrived to my jira account i have to fetch description automatically. Am trying for that.

Can you help me.

DPK_J Community Leader Sep 08, 2019

@AnnapurnaI have already replied for this in your other question.

In external environment, you only have two possibilities, Polling Search API, or Webhooks.

 

Also, if my above answer helped you, please upvote and accept it, so that other people looking for same thing can also get help.

1 vote
Answer accepted

Hi,

I am trying to fetch latest comment from JIRA ticket. 

i used this in python script.

issue.fields.comment 

<class 'jira.resources.PropertyHolder'>

this is the output i received.

Please let me know what is the issue
DPK_J Community Leader Sep 09, 2019

You need to do something like this,

comments =  issue.fields.comment.comments

for comment in comments:
    print("Text: ", comment.body)
0 votes
DPK_J Community Leader Sep 08, 2019

You have two ways to do this,

  1. Using Jira Python (python wrapper for calling Jira API's)
    1. Reference - https://pypi.org/project/jira/
    2. Comments Example - https://jira.readthedocs.io/en/latest/examples.html#comments
  2. Using rest API's provided by Jira
    1. You will need to use 'requests' module from python (or any other) to simply consume Rest API provided by Jira
    2. API Reference - https://docs.atlassian.com/software/jira/docs/api/REST/8.2.2/
    3. Get comment based on issue - https://docs.atlassian.com/software/jira/docs/api/REST/8.2.2/#api/2/issue-getComments
DPK_J Community Leader Sep 10, 2019

Can you also mark this as accepted solution if someone is looking for comprehensive solution.

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you