How to close jira issue using rest appi

I'm unable to close kita issue. I tried with transition I'd, status id. Nothing is working. I'm using put method rest API. Some one please help me.

1 answer

1 vote

We don't know what you've tried, how your system is configured or what errors you are getting.

Thank you for your response. I am using PUT method and updating comments as well as state set to done. Below JSON I have tried.

"update": {
"comment": [
"add": {
"body": "comments"
"transition" : {"id":"31"}

Transition id for the value 'DONE' is 31.

When I run this , I am getting 201 but status not changed only comments are updated.


So you are making two separate calls to the REST API?  One for comment and one for transition?

What happens if you put the transition first?

Getting status as 204 but issue is still open, only comments are updated.

Ok, what if you just try the transition alone?

You also say "transition id for done is 31" - are you sure that is the transition ID and not the status id for Done?  The id can easily vary by workflow, and 31 is used in a lot of examples, so I've got to check you're not just copying that without checking the workflow.

It is correct transition id only , i verifed. I also tried with transition id alone, this time I get 400 code and in response says method failed

Ok, that's better, we're getting a proper error message.  What does the rest of it say?

Nothing else, just method failed with code as 400

Hmm.  What type of call is it?  put/get/etc?

somehow the comment i entered is deleted?

I am using PUT method.

Do I need to use POST method to change the status field?

Also will the transition id differ for for DONE status, in one of the issue, I am getting the transition id as 41, another issue is showing 31. Will it differ for each issue based on current status? 

Yes, try post instead.

You don't normally set a JIRA issue status in most cases.  A status change is the result of a transition, so it'll be done for you when we can get this to work!

Transition IDs vary, yes.  Within a workflow, the ids will always be unique, but the transitions can be shared.  You might have "done" with an ID of 31 that is used on Open -> Done, and Dev -> Done, but then have 41 being the transition from Test -> Done.

Thank you for your help. I tried POST method and I can able to close the JIRA issue.

Thank you once again.


Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 09, 2018 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 ...

244 views 6 0
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you