Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,464,386
Community Members
 
Community Events
176
Community Groups

Add a comment and mention users using Confluence API

Hello, I'm trying to add a comment with a mention to some users using Confluence API.

This is the request:

{
"type": "comment",
"mode": "create",
"container":
{
"id": "pagId",
"type": "page"
},
"body": {
"storage": {
"value": "THIS S A TEST. PLEASE IGNORE THIS COMMENT.<ac:link><ri:user ri:userkey=\"userId1\"/></ac:link>, <ac:link><ri:user ri:userkey=\"userId2\"/></ac:link>, <ac:link><ri:user ri:username=\"name.surname\"/></ac:link>",
"representation": "storage"
}
}
}

 

It is working, but the users' name is "unlicensed user" and these users have a license. 
Screenshot 2022-03-17 at 11.32.14.png

1 answer

0 votes
Ivan Lima Community Leader Mar 17, 2022

Hi @María Cabrera, are you using the account id for the userkey? Try that instead; it should work. You can mention someone and view the storage format of the page to confirm the syntax.

<ac:link><ri:user ri:userkey="8a7f808a7******************eb330006"/></ac:link>

@Ivan Lima , yes, I'm using the account Id for the userkey

Ivan Lima Community Leader Mar 18, 2022

I tested it myself, and it turns out that userkey works, but the account id doesn't. You can get the userkey by mentioning a user on a page, publishing it, and accessing the "view storage format" settings (More actions > Advanced details > View Storage Format).

Screen Shot 2022-03-18 at 4.15.36 PM.png

I know Atlassian is deprecating username and userkey from the APIs and using the account id instead. Maybe this is yet to roll out.

Like María Cabrera likes this

Thank you Ivan, it's working now!

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events