The Patch request updates either one specified property or multiple in the user object.
Note : After creating a user, a unique identifier (ID) is assigned. Provide the ID for the user in the REST URL.
PATCH {server_url}/users/{id}
PATCH
This table lists the properties that can be updated.
| Parameter name | Type | Description |
|---|---|---|
name |
string | The user’s new name that will replace the name in the current record |
email |
string | The user’s new email |
Content-Type: application/json
This example updates the user’s email address and name.
[
{
"name": "Jake Pots",
"email": "jpots@example.com",
}
]
This return shows the updated user record with a new email address.
[
{
"name": "Jake Pots",
"email": "jpots@example.com",
"id": 3
}
]
| Status value | Return status | Description |
|---|---|---|
| 200 | Success | Removes the user and returns an empty response. |
| 404 | Error | Specified user record not found. |
| ECONNREFUSED | N/A | Service is offline. Start the service and try again. |
curl --location --request PATCH 'localhost:3000/users/3' \
--header 'Content-Type: application/json' \
--data-raw ' {
"name": "Jake Pots",
"email": "jpots@example.com",
}'