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!
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.