Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,463,764
Community Members
 
Community Events
176
Community Groups

How do I display all issue fields in the Python Jira API?

For anyone here who has used Jira-Python, if I'm using vim to edit my code, how do I display all issue fields for my project? 

 

Here is the link of the doc 

https://jira.readthedocs.io/en/master/

 

and attached picture showsissue fields.png all the common fields of an issue but my companies fields might be different. 

5 answers

You can use 

issue.raw['fields']

to get all the results obtained in the JSON object as raw string. Its not as pleasant to view, but will provide you with what you're looking for.  Take a look at this stackoverflow solution  and see if you find your answer, cheers.

I made a web application using plotly/dash on Python to make an interactive Jira work log dashboard. Users who are viewing the answer to this question might find something valuable there.  You can visit this GitHub repository.

I know this is old but this might help someone else down the road. You can do this to just get the field names: 

print(sorted(thisIssue.raw['fields'])

if you even better clarity (but more scrolling), you can put them each on a newline: 

print("\n".join(sorted(thisIssue.raw['fields'])))

I added this to an answer above but thought I would expand it here: 

I'm using this JQL to get issues that fall within a date range for a project: 


from jira import JIRA
from jira.client import ResultList
from jira.resources import Issue
import os
import datetime
import json

#set date ranges
dtOneYearPast = datetime.datetime.now() - datetime.timedelta(days=3*365)
dtThreeWeeksPast = datetime.datetime.now() - datetime.timedelta(days=21)

#convert to strings
strOneYearPast = formatDateString(dtOneYearPast)
strThreeWeeksPast = formatDateString(dtThreeWeeksPast)

strJQL = "project=KME AND status = 'Code Review' OR status = 'IN QA - DEV' OR status = 'IN QA - STG' AND createdDate > " + strOneYearPast + " AND createdDate < " + strThreeWeeksPast

and grabbing the first response and outputting the fields, sorted ascending, each field on its own line here: 



for thisIssue in jira.search_issues(strJQL, maxResults=250, expand='changelog'):
print("\n".join(sorted(thisIssue.raw['fields'])))
break


I would go this way:

project_keys = ['Zen']
issuetype_names = ['Task']
meta = jira_instance.createmeta(projectKeys=project_keys,
issuetypeNames=issuetype_names,
expand='projects.issuetypes.fields')

for x in meta:
...

Basically gives you all info, datatypes, options etc. attached to the individual fields in the corresponding project/issuetype. This also gives you the field name to the customfield_123456 fields, translations etc.

Were you able to do this? Trying the same thing and having a fairly hard time.

0 votes

Hi! 

Please, try to use the Pycharm, or vs code to edit. 

regarding to view in one shot I do recommend a look into postman side

Suggest an answer

Log in or Sign up to answer