Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Markdown

Bot October 5, 2021

How can I insert a link to another comment via the API in a comment?

May be some special form in markdown

1 answer

1 accepted

1 vote
Answer accepted
Neil Mansilla
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 5, 2021

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!

Bot October 6, 2021

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?

Neil Mansilla
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 6, 2021

@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.

Bot October 7, 2021

Thank you so much

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events