pythonjirapython-jira

Fetching entire changelog for an issue in JIRA using jira-python


Using jira-python, I want to retrieve the entire changelog for a JIRA issue:

issues_returned = jira.search_issues(args.jql, expand='changelog')

I discovered that for issues with more than 100 entries in their changelog I am only receiving the first 100:

Screenshot from debugger

My question is how do I specify a startAt and make another call to get subsequent pages of the changelog (using python-jira)?

From this thread at Atlassian I see that API v3 provides an endpoint to get the change log directly:

/rest/api/3/issue/{issueIdOrKey}/changelog

but this doesn't seem to be accessible via jira-python. I'd like to avoid having to do the REST call directly and authenticate separately. Barring a way to do it directly via jira-python, is there a way to make a 'raw' REST API call from jira-python?


Solution

  • In instances where more than 100 results are present, you'll need to edit the 'startAt' parameter when searching issues:

    issues_returned = jira.search_issues(args.jql, expand='changelog', startAt=100)
    

    You'll need to setup a statement that compares the 'total' and 'maxResults' data points, then run another query with a different 'startAt' parameter if the total is higher and append the two together.