Patch user by ID
This operation updates or patches one or more properties of an existing user by ID.
Endpoint structure
PATCH /users/{id}
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
integer | Yes | The unique identifier of the user to update |
Request headers
| Header | Value | Required |
|---|---|---|
Content-Type |
application/json |
Yes |
Request body
Include only the properties you want to update. All fields are optional.
| Property | Type | Description |
|---|---|---|
firstName |
string | User’s first name |
lastName |
string | User’s last name |
email |
string | User’s email address |
age |
integer | User’s age |
painLocation |
string | Location of sciatica pain |
painLevel |
integer | Current pain level on a 1-10 scale |
diagnosisDate |
string | Date of diagnosis - Year-Month-Day format |
Example: Update pain level
Request:
curl -X PATCH {base_url}/users/1 \
-H "Content-Type: application/json" \
-d '{
"painLevel": 5
}'
Response - Success:
Returns the complete updated user object with all properties.
{
"id": 1,
"firstName": "Sarah",
"lastName": "Johnson",
"email": "s.johnson@example.com",
"age": 42,
"painLocation": "lower-back-left",
"painLevel": 5,
"diagnosisDate": "2024-03-15"
}
Successful response includes:
id- User identifier - unchangedfirstName- User’s first namelastName- User’s last nameemail- User’s email addressage- User’s agepainLocation- Location of sciatica painpainLevel- Current pain level on a 1-10 scalediagnosisDate- Date of sciatica diagnosis
More examples
Update pain location and level
{
"painLocation": "glute-left",
"painLevel": 6
}
Update email address
{
"email": "sarah.j@newemail.com"
}
Update many properties at once
{
"age": 43,
"painLevel": 4,
"painLocation": "lower-back-left"
}