🌐 REST API Design
Beginner
How do you map CRUD operations to HTTP methods?
Answer
CRUD operations map cleanly to HTTP methods and status codes in REST. Create: POST /resources with the new resource in the body — returns 201 Created with a Location header. Read (list): GET /resources returns a collection — returns 200 OK with an array in the body. Read (single): GET /resources/{id} returns one resource — returns 200 OK or 404 Not Found. Update (full replace): PUT /resources/{id} with the complete resource body — returns 200 OK or 204 No Content. Update (partial): PATCH /resources/{id} with only changed fields — returns 200 OK or 204 No Content. Delete: DELETE /resources/{id} — returns 204 No Content on success.
Previous
Why is JSON the standard response format for REST APIs?
Next
What does stateless design mean in REST?
More REST API Design Questions
View all →- Beginner What is REST and what are its six architectural constraints?
- Beginner What are the main HTTP methods used in REST APIs and what do they do?
- Beginner What is idempotency and which HTTP methods are idempotent?
- Beginner What are the most important HTTP status codes in REST APIs?
- Beginner What are REST resource naming conventions?