Get fields from a specific Jira issue

Found using:

print self.issue_object.raw

which returns the raw json dictionary which can be iterate and manipulate.


You can use issue.raw['fields']['desired_field'], but this way is kind of indirectly accessing the field values, because what you get in return is not consistent. You get lists of strings, then just strings themselves, and then straight up values that don't have a key for you to access them with, so you'll have to iterate, count the location, and then parse to get value which is unreliable.

Best way is to use issue.fields.customfield_# This way you don't have to do any parsing through the .raw fields Almost everything has a customfield associated with it. You can pull just issues from REST API to find customfield #'s, or some of the fields that you get from using .raw will have a customfield id that should look like "customfield_11111" and that's what you'll use.


authenticated_jira = JIRA(options={'server': self.jira_server}, basic_auth=(self.jira_username, self.jira_password))
issue = authenticated_jira.issue(self.id) 

for field_name in issue.raw['fields']:
    print "Field:", field_name, "Value:", issue.raw['fields'][field_name]

Depends on field type, sometimes you get dictionary as a value and then you have to find the actual value you want.