I am using Keycloak docker image 21.0.2 (the latest one).
I make a PUT request to this URL:
http://localhost:8080/admin/realms/custom-realm/users/14905db1-5229-4110-bfbb-df13845a4f52
and with this JSON body to edit a user's attributes:
{
"attributes": {
"organization_id": "1"
}
}
The problem is that this wipes out all user attributes and I want it to keep the old ones as they are used for other functionalities and cannot be wiped out.
I just want to append or replace 'organization_id' value in the list of user attributes.
I think it should be a PATCH request but Keycloak doesn't have one for users. Is there any way to make this work?
I tried to update user attributes through the ADMIN REST API but I think a PATCH method is missing...
I had the exact same issue and i finally resolve it by fetching first the information of the user and made a custom merge when updating the user with the keycloak admin client. It's not a fancy solution, but Keycloak at this date does not provide a way to partially update the user.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With