How to get changelog for (all issues) via Jira REST API?

Chris Lenzini July 18, 2017

I'm looking to do a mass dump of a sort of history table/ changelog for every Jira issue in our instance.

The Jira SQL direct database has this - changeItem and changeGroup.

I'm wondering if the Jira REST API has an equivalent of this is some fashion. I'm aware I can make an API call that fetches an issue changelog one by one by issueID, but this is quite tedious if you have thousands upon thousands of issues.

Is there a REST API equivalent? Or do I have to stick to the SQL direct database?

Thanks -

1 answer

0 votes
Warren
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.
July 18, 2017

You can use /rest/agile/1.0/board/{boardId}/issue to get all issues for a specific board, then /rest/agile/1.0/issue/"{issueId}?expand=changelog for each issue.

If you're looking at multiple boards, you'll need to do this for each board.

Be aware (as detailed here) about the maxResults parameter when doing the first call - by default you will only get the first 50 issues and you need to keep using the call with an incremented startAt to get all issues. Once you have the code working for it, it works well.

Chris Lenzini July 18, 2017

I'm sure it works fine, but it's tedious to make a call for literally every issue in the instance. And then when that's finished, pick the time you started the whole import, and refetch any tickets that have been updated since then and proceed from there. The SQL database literally has two tables - changeItem and changeGroup. It's dirt simple to import the full history of all jira issues. From what you've said, I take it there is no way to display the changelog for more than one issue at a time via the JSON REST API?

Warren
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.
July 19, 2017

It may seem tedious, but firstly is the only way for cloud based Jira, but also is the correct way to go. Standard advice is not to try and get data directly from the database.

It's not going to be only 2 tables, because those tables have no knowledge of the Jira Id (key), so you're going to land up having joins on about 5 or more other tables - I know because I did it a few years ago and the SQL statement can be rather large

Chris Lenzini July 19, 2017

I'm just talking first stage ETL into a data warehouse. From changeIssue and changeGroup alone you can generally find average cycle time/ lead time for a given date range across the instance - and changeGroup does have issue ID. To slice/ dice by project and any other issue fields, yet you need join to a condensed and indexed jira_issue table - that's not very difficult - it's easy to build and maintain and the performance is fast. Iterating 'last updated since' jira tickets from one REST API endpoint - then feeding that to another process that pulls these one by one from a different REST API endpoint -- that's fine but a whole lot more complication. The process will almost certainly be slower as well (though acceptable for most needs). Software like Zendesk does have an incremental 'ticket history' JSON endpoint --- simple and straightforward to implement. This 'one by one' business is really a needless bottleneck.

Chris Lenzini July 20, 2017

Just replying because I found another answer on stackoverflow. Apparently ?expand=changelog works on the search API as well -- (search endpoint being used to retrieve 1000 issues at a time, potentially by update date). Thanks for the info.

Like # people like this
Warren
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.
July 21, 2017

Hi Chris

The problem with expand=changelog is it only shows the first 20 logs and can't be increased. So, if an issue has more than 20 logs, you will have incomplete data and possibly won't be aware of it. I believe the Json packet tells you how many logs there are, so you'll need to check this and report if > 20

Chris Lenzini April 20, 2018

Hi Warren --- not sure if this depends on the Jira version. I just summed total changelog entries by each issue ID ... it's a normal distribution and there appears to be no effect whatsoever past 20 changelog entries. There is no steep cut off or hard cutoff past there in the data. Some tickets (in our data warehouse) have over 100 history logs. Maybe I'm missing some point here --- I'll have to investigate the data closer.

Jaisingh May 29, 2019

Hi Chris,

Is it possible to get only the id of histories in Changelog.

As the changelog data in very high

Like Cyril Lorphelin likes this

Suggest an answer

Log in or Sign up to answer