REST Fundamentals
This post is a concept guide to REST – including exam questions, practical examples, and key terms.
In a Nutshell
REST is an architectural style for distributed systems over HTTP: resources are addressed via URIs, manipulated through methods, and transferred as representations. The goal is loose coupling, scalability, and effective caching.
Technical Overview
REST defines six constraints:
- Client-Server
- Statelessness
- Cacheability
- Uniform Interface
- Layered System
- Optional Code on Demand
Resources are domain objects (e.g. /orders/42). Representations carry state in formats like JSON or XML, negotiated via Accept and Content-Type headers.
Method semantics:
- GET: safe and idempotent
- POST: not idempotent
- PUT: idempotent
- PATCH: not necessarily idempotent
- DELETE: idempotent
Status codes signal success or failure (200/201/204/400/401/403/404/409/500). HATEOAS uses links in representations to enable discoverable workflows. Caching relies on Cache-Control, ETag, and If-None-Match.
Exam-Relevant Essentials
- Resource-oriented URI design (no verbs in paths)
- Safe and idempotent semantics of methods
- Correct status codes (Location header with 201)
- Idempotency Key for POST (when needed)
- Security: TLS, OAuth/OIDC/JWT, CORS, rate limiting
- Economics: loose coupling
- Documentation: OpenAPI and error catalogs
Core Components
- Resource and URI design
- Representations and media types
- Method semantics
- Status codes and headers
- Content negotiation
- Caching (ETag)
- Security
- Versioning
- Observability
- Testing (contract and API)
Practical Example (Orders with HATEOAS)
{
"id": 42,
"status": "created",
"links": [
{ "rel": "self", "href": "/orders/42" },
{ "rel": "confirm", "method": "POST", "href": "/orders/42/confirm" }
]
}
Strengths and Weaknesses
Strengths
- Interoperability through standards
- Loose coupling
- Strong scalability via statelessness
- Efficient caching
Weaknesses
- Overfetching and underfetching are possible
- Complex write operations require idempotency strategies
- HATEOAS is often not applied consistently
Common Exam Questions (with Quick Answers)
- What REST constraints exist? Client-Server, Stateless, Cache, Uniform Interface, Layered System, and optional Code on Demand.
- PUT vs PATCH regarding idempotency? PUT is idempotent, PATCH is not automatically.
- How do ETag and conditional requests work?
The client sends
If-None-Match, the server responds with 304 or delivers a fresh body.
Key Takeaway
REST is more than “JSON over HTTP”: the constraints and method semantics are what matter. Well-structured error objects, versioning, and observability are what make APIs maintainable.
Study Strategy
- Analyze public APIs and map them to the constraints.
- Design your resource model (URIs, methods, status codes).
- Practice the method semantics table (safe/idempotent).
- Avoid verbs in your paths.
Essential Resources
- https://roy.gbiv.com/untangled
- https://www.rfc-editor.org/rfc/rfc9110
- https://learn.microsoft.com/azure/architecture/best-practices/api-design



