REST API Reference

Quick reference for RESTful API design patterns and HTTP method mapping.

📚 CRUD to HTTP Method Mapping

MethodCRUDEndpointResponse
GETRead/resources or /resources/:id200 OK + data
POSTCreate/resources201 Created + new resource
PUTUpdate/resources/:id200 OK + updated resource
PATCHUpdate/resources/:id200 OK + updated resource
DELETEDelete/resources/:id204 No Content

🔗 Example Endpoints

Users
GET /usersPOST /usersPUT /users/1DELETE /users/1
Posts
GET /postsPOST /postsPUT /posts/1DELETE /posts/1
Comments
GET /posts/1/commentsPOST /posts/1/commentsPUT /comments/1DELETE /comments/1

RESTful API Design Reference

REST (Representational State Transfer) is an architectural style for designing networked applications. RESTful APIs use HTTP methods to perform CRUD (Create, Read, Update, Delete) operations on resources identified by URLs.

This reference provides a quick mapping between HTTP methods and CRUD operations, along with example endpoints for common resources. Following these patterns creates consistent, intuitive APIs.

REST Design Principles

Resources are identified by URLs. Methods define actions. Responses include appropriate status codes. The API is stateless—each request contains all information needed to process it.

URL Structure Best Practices

Use nouns for resources (/users not /getUsers). Use plural names consistently. Nest related resources (/posts/1/comments). Use query parameters for filtering (/users?status=active).

Response Codes

200 OK for successful GET/PUT/PATCH. 201 Created for successful POST. 204 No Content for successful DELETE. 400 Bad Request for invalid input. 404 Not Found for missing resources. 500 Server Error for bugs.