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,295,396
Community Members
 
Community Events
165
Community Groups

How do I get a user's name or email from a `userkey` generated by the @mention macro?

Edited

I use REST API to download existing Confluence pages, then parse out @mentions. They appear like this in my page:

<ac:link><ri:user ri:userkey="abcdefghi039387472" /></ac:link> 

How can I map the alpha-numeric value in the quotes to either user name or email address?

I looked all over the place for an answer but it didn't seem possible at the moment. Is it really so?

Is there a way to import our user data than we resolve the `userkey` value locally?

 

Thanks,

2 answers

1 accepted

0 votes
Answer accepted

Update - got the following answer from Atlassian support:

With the approval of a site admin I can provide you with a data dump that contains all of the userskeys, Atlassian Account IDs and their emails. There is not a way where you can get all of this information on your own. As only support can translate the Atlassian Accounts into eMail addresses in a data dump.

0 votes
Benjamin Community Leader Jul 20, 2021

@Bing Wu 

 

I don't believe this is possible. As there's been updates to the API to keep confidentiality.

 

Here's the link about the rest API:

 

https://developer.atlassian.com/cloud/confluence/deprecation-notice-user-privacy-api-migration-guide/

I have filed a request with Atlassian support to get a definitive answer.

 

I am not following the confidentiality reasoning. The user name is visible on the page where my API user has READ permission.  I don't understand why the same API user, using a Token via an API call, somehow cannot access the same information.

Like # people like this

@Bing Wu I came across this message (and several other threads) as the result using this confluence api sdk via npm: https://www.npmjs.com/package/confluence-api

WORD OF WARNING: this package has not been updated in 3 years, and as a result, does not provide information that users might find relevant. For example, the issue I encountered was that the package's confluence.getContentByID function returns the content with the expander body.storage (and does not allow the user to change this) -- this returns the stored version of the page, which differs from what you would expect to see, and still returns the outdated, deprecated userkey, however using the expander body.view returns accountID, which is still usable.

If you are seeing this, please make sure you are getting the content with body.view and not body.storage. Don't waste the same time that I have on this issue.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
Community showcase
Published in Confluence

Confluence: Where work and wellness meet

Feeling overwhelmed by the demands of work and life? With a 25% increase in the prevalence of anxiety and depression worldwide during the pandemic, for most of us, it’s a resounding yes . 🙋‍♀️ ...

903 views 11 26
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you