How can I map a custom field name (e.g. "TestCaseID") to the customfield_12345 name?

Using jira-python to acccess the REST API, I can't work out how to extract the mapping of "English" names to the customer field numbers, so I can look at the testcase ID for any of the results of my query

2 answers

1 accepted

This widget could not be displayed.

OK, so I worked out my own answer:

from jira.client import JIRA

def import_jira_bugs:
  jira=JIRA(your_args_here)
  resp=jira.fields()
  fmap = { }
  for i in resp.json():
     field_name=i[u'name'].encode('ascii','ignore')
     field_id=i[u'id'].encode('ascii','ignore')
     fmap[field_name]=field_id
  pprint.pprint(fmap)


This widget could not be displayed.

REST API has a mentod to retrieve all fields with its name, id etc. See https://docs.atlassian.com/jira/REST/latest/#d2e393

Thanks, I've seen that already. If I wanted to delve into manually parsing stuff from the REST API directly, I wouldn't be using jira-python: is there a way to get this info from within jira-python?

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

161 views 1 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you