I want to update an existing comment. The below example works for making a NEW comment.
curl -u $AUTH_USR:$AUTH_PSW -X POST -H "Content-Type: application/json" --data "{ \\"body\\":\\"jenkins: ${COMMENT} -build ${BUILD_NUMBER}\\" }" $SERVER/rest/api/latest/issue/${TICKET_ID}/comment
I tried the below code for updating an EXISTING comment but getting 405 response:
curl -u $AUTH_USR:$AUTH_PSW -X PUT -H "Content-Type: application/json" --data "{ \\"body\\":\\"jenkins: updated! -build ${BUILD_NUMBER}\\" }" http://jira-hur-spm.fyre.ibm.com:8080/rest/api/3/issue/${TICKET_ID}/comment/1
As you can see I am using "1" for the comment ID as in 'comment number 1'. But this might be completely wrong - I actually cannot find docs on how to get a comment ID or what kind of format they are in.
If anyone can help - thank you!
Hi there once again !!
Yes it is possible.
Let me list out the steps:
First key thing here is to get the commentId of the comment you are editing. To get that we have to do one round of Get method API for issue
curl -u username:pwd -X GET -H "Content-Type: application/json" http://localhost:8080/rest/api/2/issue/{issueKey}
in the JSON output format you have to search for the comment section and there comments will be there with comment id. Like this
Next is use the below API:
curl -D- -u username:pwd -X PUT --data @data.txt -H "Content-Type: application/json" http://localhost:8080/rest/api/2/issue/{issueKey}/comment/{CommentId}
in data.txt provide like this
{
"body": "This is a comment regarding the quality of the response but edited from API."
}
Check this and let me know.
Regards,
Vishwas
Thanks again for your help and walking me through those steps.
I was close the second example I gave worked once I provided the proper comment ID and changed the api to 2 instead of 3 as per your example (don't know if that last part was relevant).
bonus question:
JIRA examples are very fond of using "-D-". Im actually struggling to get an answer as to why that is. From experimentation it just results in more verbose output is there any particular reason to use it? Is there a name for this flag I can google?
The format is strange (Most commands dont have an option requiring a closing "-").
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If it's working , well and fine, I usually take the examples from doc and change them as required.
Regarding bonus question:
I never though about this, yes most of the examples I see have -D- in the command.
that's correct it's giving verbose mode output.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.