SciaticaSisters Logo

Build patient-first applications with the Sciatica Sisters API Documentation

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.

  1. 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

  1. Open Postman and create a new request:
    1. Click New > HTTP or the + icon in the header.
    2. Set the request method to PUT using the corresponding dropdown menu.
    3. In the request URL field, enter:

      {base_url}/users/1
      
  2. Set up the request headers:
    1. Click the Headers tab below the URL field.
    2. Add a header:
      • Key: Content-Type
      • Value: application/json
  3. Set up the request body:
    1. Click the Body tab below the URL field.
    2. Select raw from the radio button options.
    3. Select JSON from the dropdown menu on the right.
    4. 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"
      }
      
  4. Click Send to make the request.

  5. The system returns the complete updated user profile. Note that many fields have changed to the new values, while the id remains 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

  1. 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"
      }'
    
  2. The system returns the complete updated user profile. Note that many fields have changed to the new values, while the id remains 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

  1. Create a new request in Postman.
  2. Set the request method to GET.
  3. In the request URL field, enter:

    {base_url}/users/1
    
  4. Click Send.

  5. You should see the user profile with Sarah’s updated last name, email address, age, pain location, and pain level.

cURL verification

  1. Run this command:

    curl -X GET {base_url}/users/1
    
  2. 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

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.