Forums

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

Retrieving comments via API doesn't have @ in the mention?

Ryan Schwartz
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 23, 2020

According to the docs for comment formatting, the mention should include a `@` in the text field. However, when I query my data, the text field does not have an `@`.

 

Example comment, pulled via REST API v3

{ "type": "mention", "attrs": { "id": "xxxxxx", "text": "Person" } },

 

When I use the REST API to post a comment, however, it fails unless I do `@Person`. It seems to me like the API doesn't follow the docs, I would expect the same message for both sending and receiving.

1 answer

Ryan Schwartz
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 23, 2020

Hi, I'm aware of how to post a comment and have been able to do so successfully. My post was more regarding the fact that the syntax to post a comment (using the document format listed above) is different than the syntax when I get a comment with the API.

 

Full example:

POST a comment (POST /rest/api/3/issue/<issue_id>/comment):

{
"type":"doc",
"version":1,
"content":[
{
"type":"paragraph",
"content":[
{
"type":"mention",
"attrs":{
"id":"xxxxxxxx",
"text":"@Person"
}
}
]
}
]
}

 GET that same comment (GET /rest/api/3/issue/<issue_id>/comment):

{
"type":"doc",
"version":1,
"content":[
{
"type":"paragraph",
"content":[
{
"type":"mention",
"attrs":{
"id":"xxxxxxxx",
"text":"Person"
}
}
]
}
]
}

 Notice the lack of `@` symbol in the text field. Why is this the case? The docs for text field state:

text the textual representation of the mention, including a leading @.

Suggest an answer

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

Atlassian Community Events