Hello,
Im trying to send an API Post request to `/comments` with the contents of a link. When the link content contains brackets the formatting breaks. This does not happened when using the UI to create a link (see test-2). But when using the API and sending the exact payload the UI does not format it properly (see test-3).
Below is the response when retrieving those two comments using the API we can see they are identical, yet they are displaying differently.
Could I get example payload of what I could send to achieve the results of test-2? I have tried escaping it in different ways with no good results.
Thank you!
{"body": "[[test-3]|https://www.warp.dev/terminus/post-json-data-with-curl]","renderedBody": "<p>[<span class=\"error\">[test-3]</span>|https://www.warp.dev/terminus/post-json-data-with-curl]</p>" }, {"body": "[[test-2]|https://www.warp.dev/terminus/post-json-data-with-curl]","renderedBody": "<p>[<span class=\"error\">[test-2]</span>|https://www.warp.dev/terminus/post-json-data-with-curl]</p>" }
Hello @Felipe Delatorre
There is a difference between Version 2 and 3 for the API for jira cloud comments.
In version 2, the comments payload uses a markdown format.
POST {url}/rest/api/2/issue/{issueIdOrKey}/comment
{"body": "Lorem ipsum" }
Add Comment v2
In version 3, the payload use a json format, allow more details divide blocks with text, links, media, and other types.
POST {url}/rest/api/3/issue/{issueIdOrKey}/comment
{"body": { "content": [ { "content": [ { "text": "Test 123", "type": "text" } ], "type": "paragraph" } ], "type": "doc", "version": 1 }}
Add Comment v3
You can see the correct format, using in browser the issue endpoint, as example in bellow:
Using version 2: https://{url}.atlassian.net/rest/api/2/issue/{issuekey}
And using version 3: https://{url}.atlassian.net/rest/api/3/issue/{issuekey}
I hope help you.
It looks like you're new here. Sign in or register to get started.