Hi folks,
I can't find any information about that so i try here.
With Jira API, i can post a comment trough the following API url:
https://my.jira.instance/rest/api/2/issue/<issue key>/comment
With the following body:
{
"body":"My single comment"
}
Then i get an answer with the ID of my new comment: (there is the 394380)
{
"self":"https://my.jira.instance/rest/api/2/issue/208609/comment/394380",
"id":"394380",
"author":{
author details
},
"body":"My single comment",
"updateAuthor":{
author details
},
"created":"2018-06-18T14:59:41.246+0200",
"updated":"2018-06-18T14:59:41.246+0200"
}
BUT, when i want to apply a transition WITH a comment through this API url:
https://my.jira.instance/rest/api/2/issue/<issue key>/transitions?expand=transitions.fields
And with this body:
{
"update":{
"comment":[
{
"add":{
"body":"My comment on transition"
}
}
]
},
"transition":{
"id":"241"
}
}
then i get no answer body. Only the answer status: 204 No content
I need to get the comment ID.
My current workaround are:
- Make a new call to get the last comment ID after the transition + comment
- Make the single comment, then make the transition call
But I'm not very happy with that.
Any help would be appreciate. Do i miss something or is it a feature that is missing in the Jira API ?
I am afraid that the REST API endpoint that performs transitions, POST /rest/api/2/issue/{issueIdOrKey}/transitions is not actually expected to provide any other REST response other than the HTTP 204 code for a successful transition. From that page:
Responses
- STATUS 400
If there is no transition specified.
- STATUS 204
Returned if the transition was successful.
- STATUS 404
The issue does not exist or the user does not have permission to view it
So although you can add comments during a transition, there has not been the expectation that the REST API would return to you the ID of that comment in that situation.
I understand if either your work-around are less than desirable, however when searching through the JRASERVER project on JAC I have not yet found another other previous requests for this particular functionality out of the transition REST response.
If you like you could create a new suggestion issue in that project. I would also recommend checking out the Implementation of New Features Policy. I can't guarantee that this feature might be implemented some day, but providing a use case and an explanation of why this would be helpful to have can then at least serve as a place where other users can watch and vote on such a request.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.