Mock PATCH Partial Update Response

Generate a mock JSON response for a PATCH partial update endpoint. Returns the full updated resource after applying changes.

Nested Data

Detailed Explanation

PATCH Partial Update Response

A PATCH endpoint allows clients to update specific fields of a resource without sending the entire object. The response typically returns the complete updated resource so the client can update its local state.

Request vs Response

Request (PATCH /api/users/123):

{
  "name": "Alice Updated",
  "role": "admin"
}

Response (200 OK):

{
  "id": "uuid",
  "name": "Alice Updated",
  "email": "alice@example.com",
  "role": "admin",
  "isActive": true,
  "updatedAt": "2026-02-27T10:30:00Z",
  "createdAt": "2025-01-15T08:00:00Z"
}

Why Return the Full Resource?

Returning the full resource after a PATCH request:

  1. Confirms which fields were actually modified
  2. Includes server-computed fields like updatedAt
  3. Allows the client to update its local cache/state in one step
  4. Avoids a subsequent GET request

PATCH vs PUT

Aspect PATCH PUT
Sends Only changed fields Entire resource
Missing fields Ignored (unchanged) Reset to default/null
Idempotent Not necessarily Yes
Use case Update profile name Replace configuration

Optimistic Updates

With this mock, you can test optimistic update patterns where the UI updates immediately and then reconciles with the server response. If the response differs from the optimistic state, the UI should roll back gracefully.

Use Case

Frontend developers implementing inline editing, settings pages, or profile update forms can use this mock to test the PATCH flow, including optimistic updates, error rollback, and UI state reconciliation.

Try It — API Response Mocker

Open full tool