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,460,445
Community Members
 
Community Events
176
Community Groups

Get accountId after updating account using PUT

I am calling PUT API to update a user account. The updated account has different username and primary email than the account on creation. In the response of the API, I am getting urn:scim:schemas:extension:atlassian-external:1.0 : [], that is no external accountId is getting fetched in the response. 

To call APIs listed in ConfluenceCloud REST APIs, I need accountId to be passed as the request parameter (like in Add space permissions for user API).

I have come across find users api where I can pass primary email of user in request parameter and get the accountId of that account in response. However, I can get accountId only if the email of the account has not been not updated since account creation. 

Is there any API to get accountId even if account's primary email has been updated? Without the accountId I cannot add space permissions for a user in Confluence cloud.

1 answer

1 accepted

1 vote
Answer accepted
Dario B Atlassian Team Jul 23, 2021

Hello @Mrinalini Pal ,

In order to get the accountID for a user via REST API there are multiple options:

1) Use the Search users REST API endpoint for Confluence and search for a string that matches the public name or display name or the email address of the user like in below example:

https://XXXXX.atlassian.net/wiki/rest/api/search/user?cql=user=dario

{
"results": [
{
"user": {
"type": "known",
"accountId": "557XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXc",
"accountType": "",
"email": "dbXXXXXXX@atlassian.com",
"publicName": "Dario B",
"profilePicture": {
"path": "/wiki/aa-avatar/557XXXXXXXXXXXXXXXXc",
"width": 48,
"height": 48,
"isDefault": false
},
"displayName": "Dario BXXXXXXXX",

 

 2) Use the Jira REST API endpoint you already found but match the displayName instead of the email address if this is not working for you:

https://XXXXXXX.atlassian.net/rest/api/3/user/search?query=dario

[
{
"self": "https://xxxxxx.atlassian.net/rest/api/3/user?accountId=5570xxxxxxxxxxxxxxxxxxxxxc",
"accountId": "557xxxxxxxxxxxxxxxxxxxxxxxxxxc",
"accountType": "atlassian",
"emailAddress": "dbxxxxxxxxx@atlassian.com",
"avatarUrls": {
[... removed ...]
},
"displayName": "Dario BXXXXXXX",

 

3) I am not sure about this since I have never tried myself, so please double-check, but the externalID that you get when using the User Provisioning REST API should match the accountID and therefore you could use one of the below endpoints: 

 

 

Finally, I'd like to get more details on the fact that you are not able to use the find users api if the email address has changed since I am not aware of this issue.

Have you actually checked if it is not just a matter of time after changing the email address (you might have to wait for it to be synchronized), or you are not able to search for email addresses that have been updated in the past days too?

Please let me know.

 

Cheers,
Dario

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events