How to Extract JIRA issue custom fields data using REST API and Python
Purpose – To extract the JIRA issue custom fields data using REST API’s and Python
JIRA rest api Java Client (JRJC) was one of the option which i could use to extract the custom field data but that would required some dependent jar to made available during the java code building.
Inspite of using such a Heavy method which required downloading of dependent jar file, i opted to use Python which has inbuild json module along with the JIRA rest api’s
Here is a sample python code which could be used to extract the jira issue data and extract all the custom fields value for particular jira issue.
print “Getting the JSON data from the JIRA Issue”
## JRA-123 is an example issue number in JIRA
json_string = urllib2.urlopen(‘http://<FQDN>/rest/api/latest/issue/JRA-123’)
json_data = json.load(json_string)
print “Getting the Fields data”
fields = urllib2.urlopen(‘http://<FQDN>/rest/api/latest/field’)
json_fields = json.load(fields)
for i in xrange(1,100 ):
Hope you enjoyed reading this article. Thank you.