How i can update a user using API REST?

1
0
-1

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);
1 answer

1
0
-1
This one is the BEST answer!

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.

Comments

Submitted by claz08 on Fri, 04/22/2016 - 20:46

Thanks, it's work.

Submitted by g.lapierre on Mon, 04/25/2016 - 09:35

Please consider validating my answer :-)

Submitted by claz08 on Tue, 04/26/2016 - 12:12

done!

Notifications