REST API design principles and best practices?
javascript
// Good RESTful design
GET /users // List users
GET /users/123 // Get user
POST /users // Create user
PUT /users/123 // Update user
DELETE /users/123 // Delete user
GET /users/123/posts // User's posts
// With query params
GET /users?page=1&limit=10&sort=name
GET /products?category=electronics&minPrice=100
// Versioning
GET /api/v1/users
GET /api/v2/usersBest practices:
- Use nouns, not verbs
- Plural resource names
- HTTP methods for actions
- Proper status codes (200, 201, 404, etc)
- Filtering, sorting, pagination
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.