curl --request PUT \
--url https://api.example.com/api/users/:id \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"email": "<string>",
"password": "<string>"
}
'{
"id": 123,
"name": "<string>",
"email": "<string>",
"role": "<string>",
"isActive": true,
"isSuspended": true,
"createdAt": "<string>",
"updatedAt": "<string>",
"error": "<string>"
}Update the authenticated user profile information
curl --request PUT \
--url https://api.example.com/api/users/:id \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"email": "<string>",
"password": "<string>"
}
'{
"id": 123,
"name": "<string>",
"email": "<string>",
"role": "<string>",
"isActive": true,
"isSuspended": true,
"createdAt": "<string>",
"updatedAt": "<string>",
"error": "<string>"
}Authorization: Bearer <token>
| Status Code | Error Message | Description |
|---|---|---|
| 400 | Invalid user id | The user ID in the path is not a valid number |
| 400 | Nothing to update | No valid fields were provided in the request body |
| 400 | Invalid email format | The email address format is invalid |
| 400 | Invalid name | The name format is invalid |
| 400 | Password must be at least 8 characters | Password doesn’t meet minimum length requirement |
| 401 | Not authenticated | No valid JWT token was provided |
| 403 | Access denied | User attempted to update another user’s profile |
| 409 | Email already exists | The email address is already in use by another user |
curl -X PUT https://api.example.com/api/users/42 \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
-H "Content-Type: application/json" \
-d '{
"name": "John Smith",
"email": "[email protected]"
}'
{
"id": 42,
"name": "John Smith",
"email": "[email protected]",
"role": "PATIENT",
"isActive": true,
"isSuspended": false,
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-03-03T14:22:15.000Z"
}