Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to determine required fields when transitioning an issue?

nyrret
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 8, 2018

Hi all,

I am currently attempting to devise a method in which I can figure out the required fields for a specific transition for an issue.  My first attempt was to use the REST API to transition the issue with no fields filled in.  My hope was that the response body would contain an error message that delineated which required fields I did not fill in.  This worked well when creating an issue using the REST API, but not when attempting a transition. 

For example, the "Begin" transition for the issue type I am working with has two required fields.  I tried sending a POST request to http://<myserver>/rest/api/2/issue/ISSUE_KEY/transitions?expand=transitions.fields with the following body:

{
"update":
{
},
"transition":
{
"id": "31"
}
}

 In return, I get an error response stating that one of the two fields that is required needs to be filled in.

{
"errorMessages": [],
"errors": {
"assignee": "Assignee is required"
}
}

This is the behavior I hoped for, because now I know that the assignee field is required.  So, my next step is to fill in the assignee field and send the request as follows:

{
"update":
{
"assignee": [{"set" : {"name":"admin"}}]
},
"transition":
{
"id": "31"
}
}

However,  when I send this request I get no response body and a status code of '204 No Content'.  The issue also successfully transitions despite the other required field (the Due Date field) not having been filled in.  I am not sure why this is the case, as when I try to manually transition the issue I am not able to without filling in that field.

Is there a better way to determine what fields are required for certain transitions?  Or am I doing something wrong in how I am sending the POST request?  Any assistance would be greatly appreciated.

Thank you!

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events