Tutorial: Update a user profile
In this tutorial, you’ll learn how to update a complete user profile using the PUT method to reflect
major changes in a user’s condition. When many details change at once, such as after a medical checkup
or significant life event, updating the entire profile ensures everything stays accurate.
Expect this tutorial to take about 10 minutes to complete.
Before you start
Make sure you’ve completed the Getting Started guide on the development system you’ll use for the tutorial.
Update a complete user profile
Updating a complete user profile requires using the PUT method to replace all fields in a user
resource. The PUT method replaces the entire user profile with new information.
This example updates the profile for Sarah Johnson, user ID 1, after most of her information changed. She has gotten married and needs to update her last name and email. She also needs to revise her age and current pain information.
-
Make sure your local service is running, or start it by using this command in the terminal:
cd <your-github-workspace>/SciaticaSisters-API/api json-server -w sciatica-sisters-db-source.json
Postman request
- Open Postman and create a new request:
- Click New > HTTP or the + icon in the header.
- Set the request method to
PUTusing the corresponding dropdown menu. -
In the request URL field, enter:
{base_url}/users/1
- Set up the request headers:
- Click the Headers tab below the URL field.
- Add a header:
- Key:
Content-Type - Value:
application/json
- Key:
- Set up the request body:
- Click the Body tab below the URL field.
- Select raw from the radio button options.
- Select JSON from the dropdown menu on the right.
-
In the text area, enter:
{ "firstName": "Sarah", "lastName": "Martinez", "email": "s.martinez@example.com", "age": 43, "painLocation": "lower-back-right", "painLevel": 4, "diagnosisDate": "2025-10-15" }
-
Click Send to make the request.
-
The system returns the complete updated user profile. Note that many fields have changed to the new values, while the
idremains the same.{ "id": 1, "firstName": "Sarah", "lastName": "Martinez", "email": "s.martinez@example.com", "age": 43, "painLocation": "lower-back-right", "painLevel": 4, "diagnosisDate": "2025-10-15" }
cURL request
-
Open your terminal and run this command:
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": "lower-back-right", "painLevel": 4, "diagnosisDate": "2025-10-15" }' -
The system returns the complete updated user profile. Note that many fields have changed to the new values, while the
idremains the same.{ "id": 1, "firstName": "Sarah", "lastName": "Martinez", "email": "s.martinez@example.com", "age": 43, "painLocation": "lower-back-right", "painLevel": 4, "diagnosisDate": "2025-10-15" }
Check your results
Postman verification
- Create a new request in Postman.
- Set the request method to
GET. -
In the request URL field, enter:
{base_url}/users/1 -
Click Send.
- You should see the user profile with Sarah’s updated last name, email address, age, pain location, and pain level.
cURL verification
-
Run this command:
curl -X GET {base_url}/users/1 -
You should see the user profile with Sarah’s updated last name, email address, age, pain location, and pain level.
Common errors and troubleshooting
Fields disappeared after update
PUT replaces the entire user resource. If you only send some fields, the missing fields should disappear
or get set to default values. You must include all required fields: firstName, lastName, email,
age, painLocation, painLevel, and diagnosisDate.
404 not found error
If you receive this error, the user ID in your request URL doesn’t exist. Verify the correct user ID
by calling GET on /users first to see all available users.
Invalid pain location value
The painLocation field only accepts specific values. Use one of: lower-back-left, lower-back-right,
glute-left, glute-right, calf-left, or calf-right.
What you learned
After completing this tutorial, you now know how to update a complete user profile using the PUT
method with Postman or cURL. This is useful when many user details change at once, such as after a medical
checkup or major life event. For updating just one field, like pain level only, use the PATCH
method instead. You’ve successfully kept a user profile up to date.
Next steps
- Update a user’s pain level when pain changes.
- Create a user profile to add a patient.
- Compare exercises to see which activities are effective.
Related topics
Security note
In a production environment, this operation would require proper authentication to ensure only authorized users can change patient data. See Authentication for details.