Hello all!
I'm having a bit of trouble resolving issues via the API, I'm using Node.js to hit the endpoint and I maybe confused about which id I should be using.
function closeTicket(ticket) {
var closingId = "10000";
if (typeof(ticket.key) === 'undefined') {
return reject(ticket);
}
ticket.key + "/transitions/?expand=transitions.fields&transitionId=5";
var url = "https://" + JIRA_USER + ":" + JIRA_PASS + "@dbisoftware.atlassian.net:443/rest/api/2/issue/" + ticket.key + "/transitions";
return new Promise((resolve, reject) => {
request({
url : url,
body: JSON.stringify({
"update": {
"comment": [
{
"add": {
"body": "Bug has been fixed."
}
}
]
},
"fields": {
"resolution": {
"name": "Done"
}
},
"transition": {
"id": closingId
}
})
}, (err, res, body) => {
if (err) return reject(err);
ticket._toJira = body;
console.log(body);
console.log(ticket);
return resolve(ticket);
})
});
}
The following is the response I get back from endpoint
{
"expand": "transitions",
"transitions": [
{
"id": "11",
"name": "Start Progress",
"to": {
"self": "https://dbisoftware.atlassian.net/rest/api/2/status/10407",
"description": "Assignee is currently actively working on issue.",
"iconUrl": "https://dbisoftware.atlassian.net/images/icons/statuses/generic.png",
"name": "In Progress",
"id": "10407",
"statusCategory": {
"self": "https://dbisoftware.atlassian.net/rest/api/2/statuscategory/4",
"id": 4,
"key": "indeterminate",
"colorName": "yellow",
"name": "In Progress"
}
}
},
{
"id": "21", // Should I be using this ID?
"name": "Done",
"to": {
"self": "https://dbisoftware.atlassian.net/rest/api/2/status/10000",
"description": "",
"iconUrl": "https://dbisoftware.atlassian.net/images/icons/statuses/closed.png",
"name": "Done",
"id": "10000", // Or should I be using this ID?
"statusCategory": {
"self": "https://dbisoftware.atlassian.net/rest/api/2/statuscategory/3",
"id": 3, // OR maybe this ID?
"key": "done",
"colorName": "green",
"name": "Done"
}
}
}
]
}
I've tried all 3 ids listed in the response above but when I visit the ticket the status of the ticket remains unchanged.
Any help would be greatly appreciated!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.