Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Listing All JIRA Transitions via API

I'm looking to set up smart commits in JIRA, but my developers want to know all the options for their transitions. In order to help them, I'd like to print a cheat-sheet of all transition names (I trust they are smart enough to figure out what does what from there).

But when I look through the REST API documentation, I can only find a way to get the list of transitions for a particular issue (presumably via its status). Is there a way to get the list of all transitions that any ticket can take at any point in its workflow?

like image 892
ABMagil Avatar asked Aug 10 '15 20:08

ABMagil


People also ask

How do I get a list of sprints in JIRA API?

You can get all sprints (for a board) using GET /rest/agile/1.0/board/{boardId}/sprint . Notice the Jira Software-specific concepts (boards, epics, sprints, estimates) are in their own API separate from the base level Jira platform API.

How do I find the transition ID in JIRA?

Obtaining a transition ID You can get the ID you need in either of the following ways: By using the API, with a request like https://yourcompany.atlassian.net/rest/api/2/issue/ISSUE-123/transitions using an issue that is in the appropriate “open” state.

How do I get all users in JIRA API?

to get all active users: GET /rest/api/2/user/search? username=. Save this answer.

Can JIRA make an API call?

Summary. Not all of Jira REST API methods are available on Automation for Jira as actions - but we have the Send web request, that can be used to call REST APIs!


2 Answers

You can list the transitions of a given ticket via this endpoint:

/rest/api/2/issue/${issueIdOrKey}/transitions

For a more in depth explanation take a look here: Does the JIRA REST API require submitting a transition ID when transitioning an issue?

like image 191
Brett Reinhard Avatar answered Oct 09 '22 03:10

Brett Reinhard


You can get all transitions for project with /rest/api/2/project/{projectIdOrKey}/statuses endpoint. Here is response example, look at "statuses" array:

[
    {
        "self": "http://localhost:8090/jira/rest/api/2.0/issueType/3",
        "id": "3",
        "name": "Task",
        "subtask": false,
        "statuses": [
            {
                "self": "http://localhost:8090/jira/rest/api/2.0/status/10000",
                "description": "The issue is currently being worked on.",
                "iconUrl": "http://localhost:8090/jira/images/icons/progress.gif",
                "name": "In Progress",
                "id": "10000"
            },
            {
                "self": "http://localhost:8090/jira/rest/api/2.0/status/5",
                "description": "The issue is closed.",
                "iconUrl": "http://localhost:8090/jira/images/icons/closed.gif",
                "name": "Closed",
                "id": "5"
            }
        ]
    }
]

But it doesn't give you exactly list of transitions that any issue can take at any time, and I'm not sure that such method exist in API.

like image 28
Bushikot Avatar answered Oct 09 '22 03:10

Bushikot