How to update issue status edit api?

sbmaggarwal May 26, 2016

I am using 'https://domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}' to edit an issue. I want to use the same API to change the status as well. While following works in edit with PUT method,

{
    "fields":
    {
        "assignee":{"name":"assigneeKey"},
        "priority":{"name":"Highest"},
        "issuetype" : {"name" : "Bug"},
		"summary": "Summary"
    },
    "update": {
			"description": [{
				"set": "Hello description"
			}]
    }
}

'transition' key doesn't work for me. I used it like this 

"transition": {
            "id": "1"}

directly inside the root JSONObject. Server returned with 204 status code but no change was done in Issue.

1 answer

1 vote
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 26, 2016

Is transition 1 representing a transition that exists in the workflow?  Is the issue in the right status?  (i.e. the transition is the one that takes it out of that status/step to the desired one?).  Does the workflow have any validators or conditions on it that might be blocking the transtion? (Although I'd expect an error there, rather than a simple 204)

Edit: sorry, that was far too short!  I've tried to improve it.

sbmaggarwal May 26, 2016

I tried values from 1 to 20 randomly.. None works. I mean I get a 204 No Content response but status doesn't change. To answer your question, 1 is valid.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 26, 2016

Random numbers really aren't going to do anything!  Could you look at the text view of the workflow?  Especially for the step the issue is currently in?

Steven F Behnke
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 26, 2016

Just a tidbit to add to Nic's great answer, you can use the API to get all transitions and ID's valid for your current state for a specific issue – http://jira.example.com/rest/api/2/issue/TST-123/transitions

The documentation for this REST endpoint is avaliable here – https://docs.atlassian.com/jira/REST/latest/#api/2/issue-getTransitions

 

Otherwise Nic is right, the correct id value is in the Workflow Editor.

Suggest an answer

Log in or Sign up to answer