<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi Stain,<br><br>I included a sample scenario as follows, in that I have updated only one field which is "enabled" field. But this is common for rest of the fields and attributes as well. <br><br>1. <i>Before the update (test user's original information):</i><br><br>{<br> "id":"c2279ae4-99b7-403c-9ac7-0ff838ff1b83",<br> "username":"test-user",<br> "enabled":true,<br> "totp":false,<br> "emailVerified":false,<br> "firstName":"test",<br> "lastName":"user",<br> "email":"test-user@test.com",<br> "attributes":{<br> "locality":"Redwood city",<br> "country":"USA",<br> "region":"CA",<br> "postal_code":"94065",<br> "street":"Holly St"<br> },<br> "requiredActions":[<br><br> ]<br>}<br><br>2. <i>Update user as following : <br></i>Update user with just one field<br>API call : PUT /auth/admin/realms/leapset/users/test-user
<br><br>Headers :<br>Accept: application/json
<br>content-type: application/json
<br>Authorization: Bearer TOKEN
<br><br>Request body : <br>{"enabled":false}<br><br>After the update fields like email, firstname, lastname are missing <br><br>{<br> "id":"c2279ae4-99b7-403c-9ac7-0ff838ff1b83",<br> "username":"test-user",<br> "enabled":false,<br> "totp":false,<br> "emailVerified":false,<br> "attributes":{<br> "locality":"Redwood city",<br> "country":"USA",<br> "region":"CA",<br> "postal_code":"94065",<br> "street":"Holly St"<br> },<br> "requiredActions":[<br><br> ]<br>} <br><br><div>> Date: Thu, 2 Jul 2015 02:26:51 -0400<br>> From: stian@redhat.com<br>> To: chamantha@outlook.com<br>> CC: keycloak-user@lists.jboss.org<br>> Subject: Re: [keycloak-user] Update the user only with required fields<br>> <br>> Send me the json you're updating with an what fields are changed and I'll look into it<br>> <br>> ----- Original Message -----<br>> > From: "Chamantha De Silva" <chamantha@outlook.com><br>> > To: "Stian Thorgersen" <stian@redhat.com><br>> > Cc: keycloak-user@lists.jboss.org<br>> > Sent: Friday, 26 June, 2015 7:18:08 AM<br>> > Subject: RE: [keycloak-user] Update the user only with required fields<br>> > <br>> > Hi Stain,<br>> > <br>> > Thank you for your response, we are using Keycloak 1.2.0 final and in that<br>> > version we do have that problem. If we update only particular element in<br>> > user update call it will truncate (turn to default values in some cases eg :<br>> > boolean).<br>> > <br>> > Best Regards,<br>> > Chamantha<br>> > <br>> > > Date: Thu, 25 Jun 2015 10:20:53 -0400<br>> > > From: stian@redhat.com<br>> > > To: chamantha@outlook.com<br>> > > CC: keycloak-user@lists.jboss.org<br>> > > Subject: Re: [keycloak-user] Update the user only with required fields<br>> > > <br>> > > You can just send the user json and only include the attributes you want to<br>> > > change.<br>> > > <br>> > > ----- Original Message -----<br>> > > > From: "Chamantha De Silva" <chamantha@outlook.com><br>> > > > To: keycloak-user@lists.jboss.org<br>> > > > Sent: Thursday, 25 June, 2015 1:22:31 AM<br>> > > > Subject: [keycloak-user] Update the user only with required fields<br>> > > > <br>> > > > Hi Team,<br>> > > > <br>> > > > There are situations that we use update user rest API, to update just one<br>> > > > element of user (eg: enabled : false etc.) .<br>> > > > This requires a pre fetched user object from the GET user call, other<br>> > > > wise<br>> > > > rest of the user information tend to be truncated after the update call.<br>> > > > <br>> > > > Is there a possibility to update only specific elements of the user<br>> > > > instead<br>> > > > of sending whole the user object (objective is to avoid the GET call<br>> > > > right<br>> > > > before the update call and avoid possible tendency of data truncations )?<br>> > > > Your kind reply is highly appreciated.<br>> > > > <br>> > > > Best regards,<br>> > > > Chamantha<br>> > > > <br>> > > > _______________________________________________<br>> > > > keycloak-user mailing list<br>> > > > keycloak-user@lists.jboss.org<br>> > > > https://lists.jboss.org/mailman/listinfo/keycloak-user<br>> > <br></div>                                            </div></body>
</html>