Hello there,
Is there a way to use the Confluence API to receive the "ri:usekey" value?
Referring to:
Confluence Cloud REST API Developer Guide
and:
We are able to to get user information, using the "Get user" API, if I know the {accountID}, using GET of said user in advance.
https://your-domain.atlassian.net/wiki/rest/api/user?accountId={accountId}
However, there are a few page macros, for example:
that when viewing the HTML source, the macro object uses the "ri:userkey" value, and not the {accountID}.
<ri:user ri:userkey="8a7f808565a1b953011234567890z" />
We maintain quite a large number of individual profile pages, which we deploy and maintain 100% via the Confluence API.
Couple of questions:
Thank you in advance for you feedback & advice.
I have the same issue. Really need the `ri:user ri:userkey` to generate some pages :/
Edit:
Well, it turns out, you can reference it using username, which can be accountId.
<ac:link>
<ri:user ri:username="8a7f808565a1b953011234567890z"/>
</ac:link>
I've tested it on profile picture macro and it works!
Source: https://community.atlassian.com/t5/Confluence-questions/User-mention-Macro-REST-API/qaq-p/1037118
Edit2:
To get accountID you can use this API call (where org is your organization name):
https://org.atlassian.net/wiki/rest/api/search/user
With CQL query (https://developer.atlassian.com/server/confluence/advanced-searching-using-cql/), fullname used as example
cql = user.fullname~"surname"
So the full query will look like this:
https://org.atlassian.net/wiki/rest/api/search/user?cql=user.fullname~%22surname%22
I came across this message (and several other threads) as the result of getting the userkey from confluence pages that I was retrieving via the API.
When using expander body.storage as part of the request, the response was providing userkey values which, as of GDPR changes, are effectively useless.
However, using the expander body.view as part of the request, the response sends back the appropriate accountID value of mentions in the page.
Hoping that this information helps people not waste the same time that I did.
Please leave me a 👍 if this helped you so I can feel my time was worthwhile 😅
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unfortunately this does not work for the reverse case though. When confluence generates the html for a user being mentioned on the page, it will use the userkey (as per the original post in this ticket).
There is still no way to look up the userkey and convert it to an accountId, as far as I am aware.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am also trying to find the solution to this problem
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Worked for me too!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Confirming that this works. I was able it generate pages using this way.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It indeed looks like this is an unfortunate interaction between the GDPR migration you referenced, and the XML storage format for these macros. In any case, it's preventing me from matching a User Mention to a human-readable name.
Is there any kind of API, private or not, that can be used to match a user key to a name or account ID?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I also need to be able to retrieve the user's Display Name from the ri:userkey in the User Profile macro.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.