Jira API to tag user in Comment

Pravin August 16, 2021

Hi 
I am able to add comment to issue in Jira through API  but i am struggling to mention/tag user in that comment i am using below API 

curl -D- -u admin:adminxyz-X POST --data '{"body": {"type": "mention","attrs": { "id": "xyz","text": "hi @XYZ "}}}' -H "Content-type: application/json" https://myjira-prod.com/rest/api/2/issue/Test-123/comment

 

{"errorMessages":["Can not deserialize instance of java.lang.String out of START_OBJECT token\n at [Source: org.apache.catalina.connector.CoyoteInputStream@6851c17a; line: 1, column: 2] (through reference chain: com.atlassian.jira.issue.fields.rest.json.beans.CommentJsonBean[\"body\"])"]}+  

 

5 answers

1 vote
Prince Nyeche
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 18, 2021

Hi @Pravin 

I believe in v2 for servers you can use this format

curl -D- -u admin:adminxyz -X POST 
--data '{"body": "Hi [~XYZ]"}'
-H "Content-type: application/json" https://myjira-prod.com/rest/api/2/issue/Test-123/comment
1 vote
Prince Nyeche
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 16, 2021

Hi @Pravin 

I think you're using the API v3 version of mentioning users while calling the v2 endpoint!

0 votes
Benny Horowitz January 6, 2022

/

0 votes
Pravin August 19, 2021

Hi @Prince Nyeche ,

 

Thank you it is working now !

0 votes
Pravin August 17, 2021

Hi @Prince Nyeche ,

Thanks for your response 

Is there any API in V2 to mention user in comment ?

Suggest an answer

Log in or Sign up to answer