jirajira-rest-api

accessing transition history via JIRA REST API


I found another person apparently having this issue but I thought I'd re-ask the question to see if I could make it more explicit.

I'm using the JIRA 6 REST web API and successfully pulling lots of data that matches our web cloud UI.

Now I'd like to see the transitions a given issue has been thru, preferably with info about who performed the transition.

I can see this transition history in our JIRA web UI but I haven't figured out how to access programmatically yet.

There's a promising sounding API:

http://example.com:8080/jira/rest/api/2/issue/{issueIdOrKey}/transitions [GET, POST]

And this is the API the previous asker seemed to have been using. From what I can tell it only returns the valid transitions you can ask for on the issue at a given point in time.

I would like a history of transitions, such as when the issue went to code review, QA, closed, etc.

I have done a expand=changelog but the change log does not correlate with the transitions that I can see.

Any tips would be appreciated. Thanks.


Solution

  • When you use expand=changelog, then all changes that have been done in issue are there. Exactly same info as in All tab in Activity section when viewing in web browser.

    When I send:

    http://jira.my.server.se/rest/api/2/issue/KEYF-42346?expand=changelog

    Under changelogkey I find list of histories. Each historyhas list of items. Those items are changes performed on the certain field, with to and from values.

    To find all status changes you need to do something like this:

    for history in issue.changelog.histories:
        for item in history.items:
            if item.field == "status":
                print item.toString # new value
                print item.fromString # old value
    

    Or use GET /rest/api/3/issue/{issueIdOrKey}/changelog like explained in the "get changelog" docs