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.