Python JIRA API

harshita gupta
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!
May 25, 2023

Hi , I am new in using JIRA API through python, had a few questions, I am using Jql to get required fields from a particular EPIC but I am only getting 50 results, is there a way I can increase the limit?

 

Also the fields like summary and decription are being truncated in the dataframe, how can I solve that?   Thanks!!

 

jql = "\"Epic Link\" = ''ABG-463' AND issuetype = Story ORDER BY priority DESC, key DESC MAXRESULTS 200"

2 answers

1 accepted

0 votes
Answer accepted
omcg May 25, 2023

Hi Harshita, 

"maxResults" should not be included directly in the JQL,  rather it should be sent as an additional parameter to the Jira rest api.

depending on what method you are using to make the rest call, it should look something like this:

jira.search_issues(jql, maxResults=1000)

 Let me know if this helps, if not, can you please provide the code snippit where you are making the call using your jql string?

Thanks!

harshita gupta
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!
May 25, 2023

Thanks, @omcg 

Y.
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 24, 2023

Update

0 votes
Stephen Ellwood
Contributor
October 21, 2024

I do not know if you are talking about the Atlassian Python Jira Library (installed with pip install atlassian-python-api), it seems not.

If you are using atlassian-python-api then the documentation is terrible but a look at the code reveals the following parameters for the jql method:

Get issues from jql search result with all related fields
:param jql:
:param fields: list of fields, for example: ['priority', 'summary', 'customfield_10007']
:param start: OPTIONAL: The start point of the collection to return. Default: 0.
:param limit: OPTIONAL: The limit of the number of issues to return, this may be restricted by
fixed system limits. Default by built-in method: 50
:param expand: OPTIONAL: expand the search result
:param validate_query: OPTIONAL: Whether to validate the JQL query

The limit did not seem to work properly, but start does so I make repeated calls.

def parse_jira(jira, jql_request, existing={}):
"""Generate a query based on the jql_request given to the jira instance given
"""

for results in range(0,1000,50):
found = {item['key']: Requirement(item) for item in jira.jql(jql_request, start=results)['issues']}
existing.update(found)
if len(found) < 50:
break;
return existing

Where Requirement is a class that is filled with the data.

I hope this helps people.

Suggest an answer

Log in or Sign up to answer