QA
Beginner LevelREST APIs & Web Services

What are HTTP Verbs (GET, POST, PUT, PATCH, DELETE) and when to use PUT vs PATCH?

❓ Interview Prompt: Compare HTTP CRUD operations and explain the fundamental resource replacement difference between PUT and PATCH.

HTTP Verbs define the intent of an API operation:

•
'GET': Retrieve resources (Safe & Idempotent). Should never mutate server state.
•
'POST': Create a new child resource under a collection (Non-Idempotent).
•
'PUT': Replace an existing resource completely (Idempotent). Unsupplied fields are reset to default/null!
•
'PATCH': Apply partial updates to specific fields of an existing resource (Idempotent or Non-Idempotent).
•
'DELETE': Remove a resource by ID (Idempotent).

Code Implementation Example

json
// PUT /api/v1/users/42 (Replaces ENTIRE user object)
// If 'role' is omitted, PUT resets role to null!
{ "firstName": "Alice", "lastName": "Smith" }

// PATCH /api/v1/users/42 (Modifies ONLY specified field)
{ "lastName": "Smith" }
💡Comparing complete resource replacement with PUT vs partial modification with PATCH.
🎯 Interview Key Takeaway

Use PUT for complete resource replacements and PATCH for partial resource updates.

#HTTP Verbs#PUT vs PATCH#REST API#Beginner
Back to all REST APIs & Web Services Questions→

More REST APIs & Web Services Interview Questions

Beginner LevelREST APIs & Web Services

What is HTTP Method Idempotency and how do you implement Idempotency Keys for REST APIs?

Beginner LevelREST APIs & Web Services

What are standard HTTP Status Codes (200, 201, 204, 400, 401, 403, 404, 409, 429, 500, 503)?

Beginner LevelREST APIs & Web Services

What is the Statelessness constraint in REST architecture?