Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

Recognition

  • Give kudos
  • My kudos

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Unable to update the status using api node js

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);}

1 answer

0 votes

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

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);}

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)

Can you please provide the sample node js api for changing the status of the issue.

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.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

3,997 views 11 5
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you