Put user by ID
This operation replaces all properties of an existing user by ID.
Endpoint structure
PUT /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
All fields required for a PUT operation.
| Property | Type | Required | Description |
|---|---|---|---|
firstName |
string | Yes | User’s first name |
lastName |
string | Yes | User’s last name |
email |
string | Yes | User’s email address |
age |
integer | Yes | User’s age |
painLocation |
string | Yes | Location of sciatica pain |
painLevel |
integer | Yes | Current pain level on a 1-10 scale |
diagnosisDate |
string | Yes | Date of diagnosis - Year-Month-Day format |
Example request
Request:
curl -X PUT {base_url}/users/1 \
-H "Content-Type: application/json" \
-d '{
"firstName": "Sarah",
"lastName": "Martinez",
"email": "s.martinez@example.com",
"age": 43,
"painLocation": "glute-left",
"painLevel": 4,
"diagnosisDate": "2024-03-15"
}'
Response - Success:
Returns the complete updated user object with all properties.
{
"id": 1,
"firstName": "Sarah",
"lastName": "Martinez",
"email": "s.martinez@example.com",
"age": 43,
"painLocation": "glute-left",
"painLevel": 4,
"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