I’m working with the jira-python library and need to retrieve the full changelog history for tickets. When I use the search_issues function with expand='changelog', I only get the first 100 changelog entries even though some tickets have over 500 changes.
I also tried using the issue() function for individual tickets but encountered the same limitation. Someone suggested using expand=['changelog'] as a list instead of a string, but that approach didn’t work either.
I want to stick with the Python library rather than making direct REST API calls. Is there a way to paginate through all changelog entries or retrieve the complete history?
The changelog limitation hit me hard when I built a migration tool last year. Here’s what worked: combine the issue fetch with manual pagination through the changelog resource. After getting your initial issue with jira_client.issue(issue_key, expand='changelog'), check if issue.changelog.total exceeds what you got back. Then use jira_client._session.get() to grab additional pages by building the URL yourself: {jira_base_url}/rest/api/2/issue/{issue_key}/changelog?startAt={offset}&maxResults=100. You stay within the library’s auth framework but get full pagination control. The magic is _session - it gives you the underlying requests session that jira-python uses, so you keep all the auth and connection pooling without dropping to raw REST calls.
Ugh, this limitation is so annoying! I found a workaround using the changelog property on issue objects. After fetching an issue, you can access issue.changelog.histories but you’ll need multiple calls. Fetch the issue first, then loop through with jira_client._get_json(f'issue/{issue_key}/changelog?startAt={start}&maxResults=100') until you grab all entries. It’s hacky but works within the library.
Had this exact issue a few months ago while auditing ticket histories for compliance reports. The changelog pagination is a real pain with jira-python since it doesn’t expose pagination parameters through the high-level methods. I got around it by using the raw resource methods. You can use the _get_json method to hit the changelog endpoint directly while staying in the library framework. Try jira_client._get_json(‘issue/{}/changelog’.format(issue_key), params={‘startAt’: offset, ‘maxResults’: 100}) - this gives you the pagination controls you need. If you’re handling multiple tickets, just loop through the issue() method and make separate requests for each ticket’s changelog with different startAt values. Not pretty, but it works when you need complete audit trails.