Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Urmimala Biswal September 25, 2016

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

2 votes
Jonathan Sambrook
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 31, 2018
2 votes
noamdah
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 26, 2016

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.

0 votes
Mariana_Pryshliak_Saasjet
Atlassian Partner
March 2, 2021

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

0 votes
Dougal Stephen
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 25, 2021 edited

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)

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

0 votes
Petar Petrov (Appfire)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 26, 2016

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

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, jira cloud certification, managing jira projects, jira project administration, jira cloud exam, atlassian certification, agile project management, jira workflows, jira permissions, jira training, jira cloud skills, atlassian learning

Become a Certified Jira Service Project Expert 🦸🏻‍♂️

Validate your expertise in managing Jira Service Projects for Cloud. Master configuration, optimize workflows, and manage users seamlessly. Earn global 🗺️ recognition and advance your career as a trusted Jira Service management expert.

Get Certified! ✍️
AUG Leaders

Atlassian Community Events