Hi all.
I try to resolve issue using transition in rest api. So, i send POST request to URL
/rest/api/latest/issue/JMA-105/transitions?expand=transitions.fields&transitionId=5
with POST data:
{ "transition":{"id":"5"}, "\"update\"":{ "comment":[ {"add":{"body":"same comment"}} ] }, "fields":{ "assignee":{"name":"-1"}, "resolution":{"self":"https://guffer4.atlassian.net/rest/api/latest/resolution/1","name":"Fixed","id":"1"}, "worklog":{"timeSpent":"10m"} } }
And server return responce with code 400 {"errorMessages":[],"errors":{"worklog":"Field does not support update 'worklog'"}}.
if i dont send in POST data fields.worklog issue resolved correctly, bat comment not added.
What structure of the POST data is correct if i need add comment and log work?
thanks in advance.
PS: sorry for my english.
Community moderators have prevented the ability to post new answers.
To update worklog while transitioning issue you have to pass worklog item in "update" section, like you do with comment:
{ "update": { "worklog" : [ { "add": { "timeSpent" : "6m" } } ] }, "transition" : { "id" : "4" } }
Cheers,
Alek.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pavel,
Please check whether the field worklog is available to be updated during that transition. You can request using /rest/api/2/issue/{issueIdOrKey}/transitions?expand=transitions.fields to check the list of fields that are available.
If worklog field is not in the list, try to add worklog field in the trasition's screen in JIRA UI. Once added, check the list again.
From the documentation here:
" If a field is not configured to appear on the transition screen, then it will not be in the transition metadata, and a field validation error will occur if it is submitted."
Checking the list of available response for code 400, it does match your current problem now which due to the field is not available.
Hope this helps.
Regards,
Fahd
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Fahd,
for geting fields for transition i use url /rest/api/2/issue/{issueIdOrKey}/transitions?expand=transitions.fields&transitionId=5 and create form dinamicly based on response. This response is:
{"expand":"transitions","transitions":[{"id":"5","name":"Resolve Issue","to":{"self":"https://guffer4.atlassian.net/rest/api/2/status/5","description":"A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.","iconUrl":"https://guffer4.atlassian.net/images/icons/status_resolved.gif","name":"Resolved","id":"5"},"fields":{"assignee":{"required":false,"schema":{"type":"user","system":"assignee"},"name":"Assignee","autoCompleteUrl":"https://guffer4.atlassian.net/rest/api/latest/user/assignable/search?issueKey=JMA-105&username=","operations":["set"]},"fixVersions":{"required":false,"schema":{"type":"array","items":"version","system":"fixVersions"},"name":"Fix Version/s","operations":["set","add","remove"],"allowedValues":[]},"resolution":{"required":true,"schema":{"type":"resolution","system":"resolution"},"name":"Resolution","operations":["set"],"allowedValues":[{"self":"https://guffer4.atlassian.net/rest/api/latest/resolution/1","name":"Fixed","id":"1"},{"self":"https://guffer4.atlassian.net/rest/api/latest/resolution/2","name":"Won't Fix","id":"2"},{"self":"https://guffer4.atlassian.net/rest/api/latest/resolution/3","name":"Duplicate","id":"3"},{"self":"https://guffer4.atlassian.net/rest/api/latest/resolution/4","name":"Incomplete","id":"4"},{"self":"https://guffer4.atlassian.net/rest/api/latest/resolution/5","name":"Cannot Reproduce","id":"5"}]},"worklog":{"required":false,"schema":{"type":"array","items":"worklog","system":"worklog"},"name":"Log Work","operations":["add"]}}}]}
as you can see (at the end of string) worklog is in response.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.