How to mention user using rest api in Jira?

prabhu October 10, 2023

Hi Team,

I am using Create Issue REST API to create ticket in Jira. Now I want to mention some users in the description while creating JIRA Ticket. How can I do that? Can I get syntax for how to achieve this?

Thanks in advance

1 answer

1 accepted

1 vote
Answer accepted
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 11, 2023

Hi @prabhu 

If you're using the V2 rest API, which I would recommend, you can use Jira's wiki markup syntax to mention a user:

[~ACCOUNTID]

where ACCOUNTID is the account ID of the user, which you can find in various ways such as in the URL of the user's profile page. 

prabhu October 11, 2023

HI @David Fischer , Can I use this account id in this below description syntax? Because I have tried this but that isn't worked out!!! That's why I have asked for syntax.

"description",{"content":{{"content":{{"text":"Kindly check the below link to access the Yesterday missed out candidates report. ","type":"text"},{"type":"hardBreak"},{"type":"text","text":"Yesterday Missed Out Candidate Report","marks":{{"type":"link","attrs":{"href":Field1}}}},{"type":"hardBreak"},{"type":"text","text":"This Week Missed Out Candidate Report","marks":{{"type":"link","attrs":{"href":Field2}}}}},"type":"paragraph"}},"type":"doc","version":1

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 11, 2023

In the V3 rest API you are using ADF as the value of rich text fields. The syntax for mentioning a user is described here: https://developer.atlassian.com/cloud/jira/platform/apis/document/nodes/mention/

prabhu October 11, 2023

Thanks @David Fischer . It works now. One final question, can we mention multiple users in a single map field for example current syntax is like this
{ "type": "mention", "attrs": { "id": "ABCDE-ABCDE-ABCDE-ABCDE", "text": "@Bradley Ayers", "userType": "APP" } }

Can I customize the syntax like the below one to tag multiple users in a single map
{ "type": "mention", "attrs": { "id": "ABCDE-ABCDE-ABCDE-ABCDE, BCDE_BCDE, CDEF-CDEF", "text": "@Bradley Ayers, @Karan, @Kishan", "userType": "APP" } }  - Like this can we apply

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 11, 2023

No, but you can add multiple mention "objects" one after the other, and if you want to separate them with commas, you'll need to add the commas as text in between.

Like prabhu likes this
prabhu October 11, 2023

Okay understood. Thanks for the syntax.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events