2

I am trying the following expression to retrieve data about a JIRA ticket with jira-python, including the links:

issue = self.jira.search_issues("key=MYPR-11", fields=["links", "worklogs", "created","timetracking", "updated", "status", "Severity", "priority", "type", "fixVersions", "affectedVersions","components", "labels", "reporter", "assignee"])

but when looking at the available fields it seems that 'links' is missing:

print(dir(issue.fields))
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'assignee', 'components', 'created', 'customfield_10010', 'fixVersions', 'issuetype', 'labels', 'priority', 'reporter', 'status', 'timetracking', 'updated']

Any idea how I can query the 'links' information with `jira-python?

Alex
  • 41,580
  • 88
  • 260
  • 469

1 Answers1

2

I am not quite sure what you want for links, but I assume you need the issue links. You used the wrong fieldname. Instead of links the field is called issuelinks.

issue = self.jira.search_issues("key=MYPR-11", fields=["issuelinks", "worklogs", "created","timetracking", "updated", "status", "Severity", "priority", "type", "fixVersions", "affectedVersions","components", "labels", "reporter", "assignee"])

If you want to have all availlable fields, try *all to include all fields . https://docs.atlassian.com/software/jira/docs/api/REST/latest/#api/2/issue-getIssue

I am not sure if jira-python supports this

EDIT

As @Alex mentioned: if no fields are specified, all available fields are returned.

ppasler
  • 3,579
  • 5
  • 31
  • 51
  • Thanks a lot; in fact, I don't see to need the fields declaration at all. The default is to return EVERY field. Problem solved... – Alex Feb 06 '17 at 12:25
  • You're welcome :) Was the `issuelink` field the field you needed? I'll update the answer. – ppasler Feb 06 '17 at 12:37