How to request JIRA API with Python examples - Softhints
How to request JIRA API with Python examples - Softhints
Search...
Jira API is simple and powerful but you may have difficulties using it with google account. You
will find many solutions on the web most of which nor working anymore as deprecated. In this
article you will find information how to run requests against the API in 2018 using python for
public and private projects(google account and atlassian accounts).
# By default, the client will connect to a JIRA instance started from the
# (see https://developer.atlassian.com/display/DOCS/Installing+the+Atlassi
# Override this with the options parameter.
options = {
'server': 'https://jira.atlassian.com'}
jira = JIRA(options)
# Sort available project keys, then return the second, third, and fourth k
By using SoftHints - Python,
keys = sorted([project.key forLinux, Pandasin
project , you agree to our Cookie Policy.
projects])[2:5]
print(keys)Accept
i
https://blog.softhints.com/request-jira-api-with-python-examples/ 1/5
6/26/22, 8:55 PM How to request JIRA API with Python examples - Softhints
# Get an issue.
issue = jira.issue('JRA-1330')
print(issue)
result:
JRASERVER-1330
[]
I wasn't able to log into private project with google accound by using jira module. But using
direct request and JIRA access token I was able to request information. It's visible in the next
section.
import requests
r = requests.get('https://myproject.atlassian.net/rest/api/2/search?jql=pr
for k in response.json().keys():
#print(k)
#print(response.json()[k])
By using SoftHints - Python, Linux, Pandas , you agree to our Cookie Policy.
if k == 'fields':
print(response.json()[k]['issuetype'])
Accept
print(response.json()[k]['description'])
print(response json()[k]['lastViewed'])
https://blog.softhints.com/request-jira-api-with-python-examples/ 2/5
6/26/22, 8:55 PM How to request JIRA API with Python examples - Softhints
print(response.json()[k][ lastViewed ])
print(r.json())
where:
Note: JIRA API authentication with password is not working in 2018 as password is deprecated.
More information below: Basic auth for REST APIs:
If you have problems accessing the API with code you can try to get this URL in the browser
while you are loged in your JIRA account:
https://myproject.atlassian.net/rest/api/latest/issue/MY_ISSUE_KEY?expand=names,renderedFields
For more information about the API you can visit this links:
Advanced Tutorials
By using SoftHints - Python, Linux, Pandas , you agree to our Cookie Policy.
https://blog.softhints.com/request-jira-api-with-python-examples/ 3/5
6/26/22, 8:55 PM How to request JIRA API with Python examples - Softhints
John D K
Apr 11, 2022 • 2 min read
John D K
Jun 2, 2020 • 3 min read
By using SoftHints - Python, Linux, Pandas , you agree to our Cookie Policy.
Request JIRA API with module jira
Request JIRA API withAccept
requests
https://blog.softhints.com/request-jira-api-with-python-examples/ 4/5
6/26/22, 8:55 PM How to request JIRA API with Python examples - Softhints
Help Us
Powered by Ghost
By using SoftHints - Python, Linux, Pandas , you agree to our Cookie Policy.
Accept
https://blog.softhints.com/request-jira-api-with-python-examples/ 5/5