Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 986
Dennis Cronin Avatar asked May 10 '15 18:05

Dennis Cronin


People also ask

How do I see transitions in Jira?

From your service project, select Project settings > Workflows. Select the edit icon next to the workflow you want to show a transition for. Select Diagram to open the diagram view.

How do I find the transition Id in JIRA API?

Go to you Project Workflow > Edit Workflow in Text Mode and you will be see transition id's for transitions.


1 Answers

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

like image 131
ThePavolC Avatar answered Sep 20 '22 11:09

ThePavolC