Skip to main content
REST API

PATCH Partial Update

RequestValidateParseMedium

What you will learn

  • JSON Patch (RFC 6902) vs JSON Merge Patch (RFC 7396) produce different results โ€” know which the API uses
  • Partial updates must not clear fields accidentally โ€” sending empty is not the same as sending null
  • Test that unmodified fields are unchanged โ€” a PATCH that resets them is a full PUT in disguise

Description

Partially update a user with only changed fields. Verify only specified fields are modified.

Test Scenario

const response = await request.patch('/api/v1/users/1', {
  data: { name: 'New Name' } // Only update name
});
expect(response.status()).toBe(200);
Endpoint/api/v1/users/:id

Testing Tips

  • โ€ขPATCH updates only specified fields
  • โ€ขOther fields remain unchanged
  • โ€ขGood for single-field updates
// Playwright API Testing - REST
import { test, expect } from '@playwright/test';
test('REST API request', async ({ request }) => {
const response = await request.get('/api/v1/resource');
expect(response.ok()).toBeTruthy();
expect(response.status()).toBe(200);
const data = await response.json();
expect(data).toBeDefined();
});

Challenge ID: rest-patch-partial-update

2 frameworks available

API Playground

Send requests and inspect responses

Endpoint: /api/v1/users/:id

Press Enter to send