How i can update a user using API REST?

hI ,

I would like update data of user. i’m using php code but i don’t know how i can create the request payload. Here is what i’m trying to do:

$data_array = array("userName" => $userName, "password" => $password, "password_confirm" => $password, "firstname" => $firstName, "lastname" => $lastName);
$data_json = json_encode($data_array);

You can PUT only the fields you want to change for the user.

For example if you want to change the lastname to Smith you could write something like:

$data_array = array ("lastname" => "Smith");
$data_json = json_encode($data_array);
put("/API/identity/user/$userId", $data_json);

Where put would be a php function doing an HTTP Put request to a given URL with the second argument content.

Thanks, it’s work.

Please consider validating my answer :slight_smile:

done!