Can't transition issue using REST API

awqeiruyt478ryfd78h August 2, 2017

Hi all,

 

I'm currently attempting to set a ticket to More Information via the REST API. I've made a call to 

/rest/api/2/issue/{issueIdOrKey}/transitions?expand=transitions.fields

 

to get the available issues, and the one I want in particular seems to be this one:

{
"expand": "transitions",
"transitions": [
{
"id": "111",
"name": "More Info",
"to": {
"self": "https://jira.WEBSITE.co.uk/rest/api/2/status/10005",
"description": "",
"iconUrl": "https://jira.WEBSITE.co.uk/images/icons/statuses/generic.png",
"name": "More information",
"id": "10005",
"statusCategory": {
"self": "https://jira.WEBSITE.co.uk/rest/api/2/statuscategory/4",
"id": 4,
"key": "indeterminate",
"colorName": "yellow",
"name": "In Progress"
}
},
"fields": {
"assignee": {
"required": false,
"schema": {
"type": "user",
"system": "assignee"
},
"name": "Assignee",
"autoCompleteUrl": "https://jira.WEBSITE.co.uk/rest/api/latest/user/assignable/search?issueKey=ISSUE&username=",
"operations": [
"set"
]
}
}
}
]
}

 

If I'm correct, I'm using the id of 111 to try and set my ticket to the status that I want it to be. My code looks as follows:

 

tickets.moreInfo = function(key) {
var transitionUrl = 'https://jira.WEBSITE.co.uk/rest/api/2/issue/TICKET-REF/transitions';
var transitionData = {
"transition": {
"id": "111"
}
};
transitionData = JSON.stringify(transitionData);

$.ajax({
type: 'POST',
url: transitionUrl,
data: transitionData,
contentType: 'application/json',
dataType: 'json'
});
}

 

No matter what, I'm always returned with either a 400 or 500 error. I've tried both the IDs 111 and 10005. Any thoughts? Am I doing something obviously stupid? Thanks!

1 answer

0 votes
TõnisO
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.
August 3, 2017

Log/inspect the actual response body of the request, if it's 400 or 500 there should be more detailed info regarding the error there.

Junio Fernandes September 10, 2018

I have same problem, but using curl. Any results from the sugestion?

Suggest an answer

Log in or Sign up to answer