REST API Reference
Quick reference for RESTful API design patterns and HTTP method mapping.
📚 CRUD to HTTP Method Mapping
| Method | CRUD | Endpoint | Response |
|---|---|---|---|
| GET | Read | /resources or /resources/:id | 200 OK + data |
| POST | Create | /resources | 201 Created + new resource |
| PUT | Update | /resources/:id | 200 OK + updated resource |
| PATCH | Update | /resources/:id | 200 OK + updated resource |
| DELETE | Delete | /resources/:id | 204 No Content |
🔗 Example Endpoints
GET /usersPOST /usersPUT /users/1DELETE /users/1GET /postsPOST /postsPUT /posts/1DELETE /posts/1GET /posts/1/commentsPOST /posts/1/commentsPUT /comments/1DELETE /comments/1RESTful 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.