To PATCH a user is to update an existing user... actually the current user logged in.
An introduction to PATCH command can be viewed on the Node PATCH command screen. Secondly, review the user API, as it outlines the structure for each of the fields that can be included. Finally, if you haven't already reviewed the introduction into setting up RESTful hal+json refer to the set-up documentation. Also see the Query - user screen. To be able to get, patch or patch you need to log in the member so you can retrieve their user id (uid).
Example of a PATCH
Using the structure outline in PATCH command screen and fields defined in the user API screen, following is an example that bridges these two together:
Request: {domain}/user/{uid}?_format=hal_json
Content-Type: application/hal+json
X-CSRF-Token: this dependant on the login credentials
Accept: application/hal+json
Body:
{"_links":{
"type":{"href":"http://your-site.com/rest/type/user/user"}},
"pass": [
{"existing":"r#sT", "value": "r#sT"}
],
"mail":{
"value":"updatedtestuser@mailserver.com"
}
}
Other examples of applying a patch
First name:
"field_firstname":{"value":"William"}
Last name:
"field_lastname":{"value":"Redpath"}
Nick name:
"field_nickname":{"value":"Bill"}
Email:
"mail":{"value":"updatedtestuser@your-site.com"}
Gender:
"field_gender":{"value":"male"}
accepted values: male, female
Mobile:
"field_mobile":{"value":"0412436"}
accepted values: integer
DoB:
"field_dob":{"value":"1989-08-07"}
accepted values: integer in date format yyyy-mm-dd
User image:
"_embedded":
{
"https://your-site.com/rest/relation/user/user/user_picture": [
{
"uuid": [
{
"value": "ea63b5e8-3f47-4320-aad9-bfe835d4f8ab"
}]
}]
}
The user's image is added using _embedded array. For more details in relation to adding or updating a user's image see the example outlined on adding an user's image.