How can I insert a link to another comment via the API in a comment?
May be some special form in markdown
Following the docs for adding an issue comment, you'll see that there's a link to something we call the Atlassian Document Format. You may have seen this format when you GET comments. Here is an example of a POST body that you'd use when adding a comment:
{ "body": { "version": 1, "type": "doc", "content": [ { "type": "paragraph", "content": [ { "type": "inlineCard", "attrs": { "url": "https://yourinstance.atlassian.net/browse/FOO-2?focusedCommentId=10063" } }, { "type": "text", "text": " " } ] } ] }}
Just switch the URL to one of our comment links (and of course, your instance name). Let me know if that works for you!
Ok, it's works. Thanks.
One more question. Can I do it via markdown?For example, if I want to provide a link to a task, I can specify the key of this task and it will automatically be converted into a link. I can put @username and it will be the link to the member. Is there a similar functionality for linking to comments or it is possible only with a full link to the comment?
@Bot - so, as to doing it in pure Markdown.. no. I don't think that's possible. You'll need to do it in ADF. So, for a username mention, it would be like this:
{ "version": 1, "type": "doc", "content": [ { "type": "paragraph", "content": [ { "type": "mention", "attrs": { "id": "4", "text": "@Summer", "accessLevel": "" } }, { "type": "text", "text": " " } ] } ]}
I recommend you check out the ADF playground. You get a WYSIWYG editor on top that does support Markdown, and at the bottom, it will convert it into ADF for you. There are even some sample usernames that you can @-mention in the editor.
Thank you so much
It looks like you're new here. Sign in or register to get started.