REST Contract Design
1 min read
Design clean API endpoints with proper resource naming, methods, and response shapes.
Design API endpoints with proper resource naming, HTTP methods, consistent response shapes, and versioning strategy.
How It Works
REST API design is about creating a contract that is intuitive, consistent, and evolvable. Resources are nouns: /users, /posts, /orders. Use HTTP methods correctly: GET (read), POST (create), PUT (full replace), PATCH (partial update), DELETE. Response shapes should be consistent. In interviews, sketching 3-5 key endpoints with request/response shapes demonstrates you can think at the API boundary.
Real-World Example
Designing Uber's ride API: POST /rides -> {id, status: "matching", eta}. GET /rides/{id} -> {id, status, driver, eta}. PATCH /rides/{id} (cancel) -> {id, status: "cancelled"}. This small surface area covers the core flow.
Test Yourself
Scenario: Design the REST contract for the "request a ride" endpoint in a ride-sharing app. Write the endpoint, request shape, response shape, and the three most important error cases.
Get notified when we launch
One email when the full practice product is live. No spam.