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

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 vote
Warren Levy Community Champion Jul 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.

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 Levy Community Champion Jul 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

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.

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.

Warren Levy Community Champion Jul 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

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.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

247 views 4 10
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you