I am trying to update the status of the bug using api node js but it is not getting updated.
var bodyData =
{ "update":
{ "summary": [ { "set": "Issue Updated" },],
"status": [{ "statusCategory": { "name": "DONE" } }]
}}
try {
var options = {
url: url
method: "PUT", json: true,
headers: { 'Authorization': 'Basic ' + new Buffer(username + ':' + password).toString("base64"), 'X-Atlassian-Token': 'nocheck',
'Content-Type': 'application/json' }, body: bodyData };
request(options, async function (error, response, body) { if (error) { console.log(error); //return response.statusCode; } else { console.log(body); } });
} catch (e) { console.log(e);}
You can't update an issue status with a simple edit action. You need to tell the API to transition the issue through a transition from its current status to the desired one.
Thanks for the reply. Can you please provide the sample API for transistion
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Used transistion but still it is not working throwing error as ["Transition id '6' is not valid for this issue."],"errors":{"comment":"Field 'comment' cannot be set. It is not on the appropriate screen, or unknown."}}
if used any id also it is not working. Please help me on this
var bodyData =
{ "update":
{ "comment": [ { "add": { "body": "Fixed." } } ] },
"transition": { "id": "6" }}
try {
var options = {
url: 'https://name.atlassian.net/rest/api/3/issue/TEST-5/transitions',
method: "POST",
json: true,
headers: { 'Authorization': 'Basic ' + new Buffer(username + ':' + password).toString("base64"),
'X-Atlassian-Token': 'nocheck',
'Content-Type': 'application/json' },
body: bodyData };
request(options, async function (error, response, body)
{ if (error) { console.log("error"+error);
} else { console.log("body"+JSON.stringify(body)); } });
} catch (e) { console.log(e);}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It sounds like the issue is in a status which does not have a transition with id 6 out of it. The comment won't apply because there's no screen for the transition for it (because there's no transition)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you please provide the sample node js api for changing the status of the issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The API you are using is the REST API - see https://developer.atlassian.com/server/jira/platform/rest-apis/ for the definition.
However, I don't think there's much (if anything) wrong with your code. The problem is that you're trying to use a transition that isn't there.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.