Skip to content
System Designintermediate · 50 min

API Design & REST

Prerequisites: System Design Basics

Design clear, consistent, evolvable HTTP APIs: resource modelling, correct status codes and verbs, idempotency, pagination, versioning, and where REST fits versus GraphQL/gRPC.

REST principles

Model nouns (resources) with URLs and act on them with HTTP verbs: GET (read, safe), POST (create), PUT (replace, idempotent), PATCH (partial update), DELETE (remove, idempotent). Use status codes meaningfully (2xx success, 4xx client error, 5xx server error) and keep responses consistent.

Robustness in practice

Paginate large collections (cursor or offset), support filtering/sorting via query params, version your API (URL or header) so you can evolve without breaking clients, and make unsafe operations idempotent (e.g. an idempotency key on POST) so retries are safe.

REST vs GraphQL vs gRPC

REST is simple, cacheable, and ubiquitous. GraphQL lets clients fetch exactly the fields they need (good for varied front-ends) but adds server complexity and caching challenges. gRPC (binary, HTTP/2, streaming) excels for low-latency internal service-to-service calls.

Resources

Practice & test yourself

Take the quiz →