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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Update user account with email unchanged using User Provisioning REST API

I am trying to update a user account using User Provisioning REST API mentioned in the https://developer.atlassian.com/cloud/admin/user-provisioning/rest/api-group-users/#api-scim-directory-directoryid-users-userid-put  document.

  • If no primary email is sent as the request body, I am getting "Invalid payload: One email address need to be marked as primary." error.
  • If primary email is unchanged in the request body, I am getting success but the user details are not getting updated.
  • If primary email is changed in the request body, I am getting success and the user details are getting updated. 

I want to change the email of the user only when the user requests for a change otherwise I want the details to get updated having the same email. Is there any work-around or is this a bug?

1 answer

1 accepted

0 votes
Answer accepted

Hello Mrinalini,

Welcome to Atlassian Community! It's nice to have you join us. 

Can you show us the query you're sending in REST-API? Please make sure to block out any private information since this is a public forum.

You might also want to try the Atlassian Developer Community. The main community is more end users, but the Developer community works with API regularly and may know what the problem is.

Thank you!
Shannon

Hi Shannon,

I am calling the following API :
curl --request PUT \
--url 'https://api.atlassian.com/scim/directory/{directoryId}/Users/{userId}' \
--header 'Authorization: Bearer <access_token>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"userName": "<string>",
"emails": [
{
"value": "<string>",
"type": "<string>",
"primary": true
}
],
"name": {
"formatted": "<string>",
"familyName": "<string>",
"givenName": "<string>",
"middleName": "<string>",
"honorificPrefix": "<string>",
"honorificSuffix": "<string>"
},
"displayName": "<string>",
"nickName": "<string>",
"title": "<string>",
"preferredLanguage": "<string>",
"department": "<string>",
"organization": "<string>",
"timezone": "<string>",
"phoneNumbers": [
{
"value": "<string>",
"type": "<string>",
"primary": true
}
],
"active": true
}'

The data passed in emails.value is same as in the existing account with userId

Hello Mrinalini,

Thank you for your reply. If you need to update the user details without changing the email, you can use PATCH instead

Can you try that and let me know if you have any trouble?

Shannon

Like # people like this

Thank you Shannon. It works like a charm.

Like Shannon Spaniol likes this

Hi Mrinalini,

That's great. Thank you for confirming. I'm happy to hear it worked.

Take care, and have a pleasant rest of your week.

Shannon

Like Dario B likes this

Suggest an answer

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

👁‍🗨 Confluence Team planning dashboard_Atlympics 🌈

Hi Atlassian's, How is your journey with #Atlympics 2021 so far....excited! Me too, same excitement. Here's my typical team planning and vision dashboard which I used to share to my management and ...

129 views 1 5
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