Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Is there any way to execute jira JQL query from python script.

Is it possible to execute JQL query from python script and get the result in a xml or character delimited format.

 

Regards,

Urmimala

(NagraVision)

5 answers

Yes, you can call jira's rest api it will return a JSON response.

In python you can use the os.system() function to use curl and get the jql required.

Check out this and this example.

Yes - use the search REST API. Also, requests is a good client library which you can use in Python to execute the REST call.

from jira import JIRA

USER = 'you@yourdomain.com'
API_TOKEN ='<api token>'

options = {"server": "https://yourdomain.atlassian.net"}
jira = JIRA(options, basic_auth=(USER, API_TOKEN))

query = """

project = "MVP"
AND status = "Development done"
AND issuetype = Subtask
ORDER BY lastViewed DESC

"""

my_jql = jira.search_issues(query)

for issue in my_jql:
print (issue.key)
print (issue.fields.customfield_10233)


##############################
#projects = jira.projects()

#for project in projects:
# print (project.key)

 

# All fields on a ticket
#ticket = 'TICKET-653'
#issue = jira.issue(ticket)

#for field_name in issue.raw['fields']:
# print ("Field:", field_name, "Value:", issue.raw['fields'][field_name])

#summary = issue.fields.summary

#print('ticket: ', ticket, summary)

##############################

Hello @Urmimala Biswal 

Can you clarify for which purposes you need a JQL function in Python?

I'll try to help you when I get to know it.

Best regards, Mariana

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

JSM June Challenge #2: Share how your business teams became ITSM rockstars

For JSM June Challenge #2, share how your non-technical teams like HR, legal, marketing, finance, and beyond started using Jira Service Management! Tell us: Did they ask to start using it or...

320 views 9 7
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you