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

Bing Wu July 20, 2021

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
Bing Wu July 22, 2021

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
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 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/

Bing Wu July 20, 2021

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
Logan McGhee December 7, 2021

@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
AUG Leaders

Atlassian Community Events