in python jira fields rest ~ read.

Easy way of getting all fields available in your JIRA instance

Recently i needed to get a full list of all fields that we have in jira just to build a map between screens and fields we want to have in each screen on every transition. I'm lazy and therefore , i decided to just write a small python script to achieve that ( thinking about copy pasting them manually made me feel sick:) ) So, here' a simple solution :

import urllib  
import urllib2  
import cookielib  
import json

jira_serverurl = "{url to your jira environment}"  
creds = { "username" : "admin", "password" : "test" }  
authurl = jira_serverurl + "/rest/auth/latest/session"

# Get the authentication cookie using the REST API
cj = cookielib.CookieJar()  
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))  
req = urllib2.Request(authurl)  
req.add_data('{ "username" : "admin", "password" : "test" }')  
req.add_header("Content-type", "application/json")  
req.add_header("Accept", "application/json")  
fp =  

add_component_url = jira_serverurl + "/rest/api/2/field"

request = urllib2.Request(add_component_url)  
fp =

json = json.loads(  
for field in json:  
    print field['name'].encode('utf8')
comments powered by Disqus
comments powered by Disqus