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

0 votes
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.

@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.

0 votes
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

You need to do something like this,

comments =  issue.fields.comment.comments

for comment in comments:
    print("Text: ", comment.body)

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

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
Community showcase
Published in Jira

The add-in you’ve been waiting for: Jira Cloud for Excel 🙌

Introducing Jira Cloud for Excel Here at the product integrations team at Atlassian, we are thrilled to announce the new Jira Cloud for Excel add-in! This add-in lets you export Jira data directly ...

971 views 10 25
Read article

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