It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Issue history through REST API

Hey,

Is it possible to get history of issue changes using REST API? If not, is there a plan to implement that in near-term future?

thanx,

Mark

5 answers

1 accepted

9 votes
Answer accepted

It can be done with JIRA 5 REST API using expansion like this:

/jira/rest/api/2/issue/DRW-124?expand=changelog

this return maximum 100 results. is there any way to override this value to get more results?

@Saurabh Garg Yes. Add at the end of the url "&maxResults = <number of results you need>"

Hi,

There is any date as a query parameter through which we can get change logs before and after the date?

thanks

From API prospective the history is called changelog (it's one of the expandos)

Here is the example of getting changelog of an issue using JIRA Rest Java Client (JRJC)


Expandos[] expandArr = new Expandos[] { Expandos.CHANGELOG };
List&lt;Expandos&gt; expand = Arrays.asList(expandArr);

final Issue isssue = issueClient.getIssue("IssueID", expand, pm);

Iterable&lt;ChangelogGroup&gt; changeLogGroupList = issue.getChangelog();
for (ChangelogGroup changelogGroup : changeLogGroupList) {
    System.out.println("Outputting the changelog group created by '"
                    + changelogGroup.getAuthor() + "' at '"
                    + changelogGroup.getCreated() + "'");
    Iterable&lt;ChangelogItem&gt; changelogItems = changelogGroup.getItems();
    for (ChangelogItem changelogItem : changelogItems) {
        System.out.println("Changing the field '"
                        + changelogItem.getField() + "' of type '"
                        + changelogItem.getFieldType() + "' from value '"
                        + changelogItem.getFrom() + "' and string '"
                        + changelogItem.getFromString() + "' to value '"
                        + changelogItem.getTo() + "' and string '"
                        + changelogItem.getToString() + "'");
    }
}

There doesn't appear to be on their REST documentation - http://docs.atlassian.com/jira/REST/latest/#resources

A workaround which is followed is that, identify which are the specific history actions you are interested in, (for example date in which the issue moved from one state to another), create custom fields and update them during transistion using postfunctions. And custom fields are available via SOAP.

Well, another workaround if you like SQL more than REST then you might want to fetch such data via JDBC (over http, of course) and put them just right inside your favorite reporting tool (like Birt, or your custom java program) without effort. The benefits are clear when you need work with the data output. Any drawback? The SQL for JIRA plugin is not free.... 

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

How InVision centralized their tools and scaled their remote team with Atlassian and Slack

Hi Atlassian Community, We recently published a case study that we thought you might be interested in. Learn about how InVision built their fully remote company’s culture using Atlassian and Slack ...

263 views 0 1
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you