PUT /api/v1/users/42/profile • HTTP 200 OK

PUT Request (Full Resource Replacement) — Request & Response Example

Illustrates the difference between PUT and PATCH. In a PUT request, the client sends the complete replacement object for the resource.

1. HTTP Client Request (PUT)

PUT /api/v1/users/42/profile HTTP/1.1
{
  "Content-Type": "application/json",
  "Accept": "application/json"
}

{
  "full_name": "Alex Rivera",
  "email": "alex.rivera@company.com",
  "title": "Principal Architect",
  "location": "San Francisco, CA",
  "bio": "Cloud architectures and developer productivity enthusiast.",
  "timezone": "America/Los_Angeles"
}

2. Server JSON Response (HTTP 200 OK)

{
  "id": 42,
  "full_name": "Alex Rivera",
  "email": "alex.rivera@company.com",
  "title": "Principal Architect",
  "location": "San Francisco, CA",
  "bio": "Cloud architectures and developer productivity enthusiast.",
  "timezone": "America/Los_Angeles",
  "updated_at": "2026-10-06T12:50:00Z"
}

Copy-Paste Code Snippets (cURL, JavaScript Fetch, Python, Node.js)

curl -X PUT "https://cometflow.space/api/v1/users/42/profile" \
  -H "Content-Type: application/json" \
  -d '{"full_name": "Alex Rivera", "title": "Principal Architect", "location": "San Francisco, CA"}'
fetch('https://cometflow.space/api/v1/users/42/profile', {
  method: 'PUT',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    full_name: 'Alex Rivera',
    title: 'Principal Architect',
    location: 'San Francisco, CA'
  })
}).then(res => res.json()).then(console.log);
import requests

payload = {"full_name": "Alex Rivera", "title": "Principal Architect"}
res = requests.put("https://cometflow.space/api/v1/users/42/profile", json=payload)
print(res.json())

How This API Call Works Step-by-Step

  1. 1. Target URL: Identifies user 42 profile.
  2. 2. Complete Payload: Client transmits all user profile fields.
  3. 3. Idempotent Update: Running this exact request 10 times results in the same database state.
  4. 4. 200 OK: Returns the fully updated object.

Backend API Functions: The API function updateUserProfile(req, res) parses the incoming payload, validates all required attributes, overwrites the record, and touches the updated_at timestamp.

Frequently Asked Questions

What is the main difference between PUT and PATCH?

PUT is a full replacement: if you omit a field in a PUT request, that field is typically wiped or reset to null. PATCH is a partial update: it only modifies the specific fields included in the request.