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

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

How do I transition an issue to a Closed state via the Jira API?

I am attempting to close Jira issues via REST API, however, I am getting a 500 error when attempting to POST to the transitions API endpoint.

I am submitting the following as JSON:

closeIssue = {
"transition":{
"id": "6"
}
}

Each submission results in the following error:

{"errorMessages":["Internal server error"],"errors":{}}

 

 

When I attempt to GET the transitions endpoint, I get the following response:

{"expand":"transitions","transitions":[]}

 

I think I should be seeing possible transitions with the GET action, but I don't see anything.

3 answers

1 accepted

1 vote
Answer accepted

Thank you all.  We found that the issue was permissions related.  The user I was using for REST work did not have permissions to perform transitions.  

We altered this and gave the user transitions and I can see the available transitions in the GET call now.  

1 vote
KellyW Atlassian Team Jul 09, 2021

With GET /rest/api/2/issue/{{issueId}}/transition, we can identify the transition ID to resolve the issue.

Then I issue POST /rest/api/2/issue/{{issueId}}/transitions with following JSON to resolve the issue:

{

"transition": {

"id": "761"

}

}

I got the internal server error if the transition ID isn't a valid transition for the issue.

Example: I was closing issue# ABC-1 with transition ID 761 but got the error doing the same for issue# ABC-2 as it was with different issue type that associated with different workflow.

Unfortunately, nothing comes back with a GET request.  I get a blank response:

{"expand":"transitions","transitions":[]}

Any idea what could be causing this?   

Something on your workflow must hide the transition so the API is returning an empty array

KellyW Atlassian Team Jul 11, 2021

Workflow condition and user permission can result in empty transition.

For example, if you have the workflow condition that only allow Assignee to transition issue, then user other than the Assignee will not be able to see any transition option.

If this is a Jira Service Management issue and user (not the issue Reporter) has no JSM application access, the transition option will not be available for this user.

The easiest approach to clarify this is to login to Jira application as the user associated to the REST call and confirm if the user can see the transition option.

0 votes

Can you check if you don't have a condition in your workflow that hide the transition

Suggest an answer

Log in or Sign up to answer
TAGS

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