Hi,
I'm trying to post comment with properties, so it would be an internal comment
post('/rest/api/3/issue/' + createdIssueKey + '/comment')
.header("Accept", "application/json")
.header("X-Atlassian-Token", "nocheck")
.header("Content-Type", "application/json")
.body([
body : fields.comment.comments.body[1],
created:fields.comment.comments.created[1],
author: [
displayName: comment.comments.author.displayName[1]
],
properties: [key: "sd.public.comment", value: [internal: true]]
])
.asJson()
and I'm getting
POST request to /rest/api/3/issue/SD-354/comment returned an error code: status: 400 - Bad Request body: {"errorMessages":["Invalid request payload. Refer to the REST API documentation and try again."]} Serializing object into 'interface java.util.Map'
I'm trying to not use "Visibility" while posting because I'm running this as ScriptRunner Add-On User and I didn't manage to add this user to specific role to post as this role.
So either way I need way to add ScriptRunner Add-On User to project roles or fix my code to post comment.
HI,
When I use this post call:
url = 'https://' + base_url + '/rest/api/3/issue/'+ issuekey +'/comment'
with the below request body
json_data = {"body":{"version":1,"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":comment}]}]},"properties":[{"key":"sd.public.comment","value":{"internal":True}}]}
Make sure to wrap the comment properties in the way I showed here:
"properties":[{"key":"sd.public.comment","value":{"internal":True}}]
It seems like just a syntax error in your code. Hope it helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.