Created
September 22, 2014 10:05
-
-
Save azakordonets/c1c9608e5af8271899f5 to your computer and use it in GitHub Desktop.
This scrip allows you easily to get full list of all your JIRA instance fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = opener.open(req) | |
fp.close() | |
add_component_url = jira_serverurl + "/rest/api/2/field" | |
request = urllib2.Request(add_component_url) | |
fp = opener.open(request) | |
json = json.loads(fp.read()) | |
for field in json: | |
print field['name'].encode('utf8') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment