REST Fundamentals
This article is a definition of terms for REST – including exam questions, practical example, and tags.
In a Nutshell
REST is an architectural style for distributed HTTP-based systems: resources are addressed via URIs, manipulated through methods, and transferred via representations. Goal: loose coupling, scalability, caching.
Compact Technical Description
REST defines six constraints:
- Client-Server
- Statelessness
- Cache-ability
- Uniform Interface
- Layered
- Optional Code on Demand
Resources are business objects (e.g., /orders/42). Representations transport state (JSON/XML), negotiated via Accept/Content-Type.
Method semantics:
- GET: safe + idempotent
- POST: not idempotent
- PUT: idempotent
- PATCH: not necessarily idempotent
- DELETE: idempotent
Status codes signal successes/failures (200/201/204/400/401/403/404/409/500). HATEOAS uses links in representations for “discoverable” workflows. Caching uses Cache-Control, ETag, If-None-Match.
Exam-Relevant Key Points
- Resource-oriented URI design (no verbs in path)
- Safe/Idempotent semantics of methods
- Status codes correct (Location for 201)
- Idempotency Key for POST (if needed)
- Security: TLS, OAuth/OIDC/JWT, CORS, Rate Limiting
- Cost-effectiveness: loose coupling
- Documentation: OpenAPI + error catalog
Core Components
- Resource + URI Design
- Representations + Media Types
- Method Semantics
- Status Codes + Headers
- Content Negotiation
- Caching (ETag)
- Security
- Versioning
- Observability
- Tests (Contract/API)
Practical Example (Orders + HATEOAS)
{
"id": 42,
"status": "created",
"links": [
{ "rel": "self", "href": "/orders/42" },
{ "rel": "confirm", "method": "POST", "href": "/orders/42/confirm" }
]
}
Advantages and Disadvantages
Advantages
- Interoperability through standards
- Loose coupling
- Good scalability through statelessness
- Efficient caching
Disadvantages
- Overfetching/Underfetching possible
- Complex write processes require idempotency strategies
- HATEOAS is often not applied consistently
Typical Exam Questions (with Brief Answers)
- What REST constraints exist? Client-Server, Stateless, Cache, Uniform Interface, Layered, optional Code on Demand.
- PUT vs PATCH regarding idempotency? PUT idempotent, PATCH not automatically.
- How do ETag + conditional requests work?
Client sends
If-None-Match, server responds with 304 or delivers new body.
Free Response
REST is more than “JSON over HTTP”: the constraints and method semantics are decisive. Clean error objects, versioning, and observability make APIs maintainable.
Learning Strategy
- Analyze public APIs and assign constraints.
- Design resource model (URIs/methods/status codes).
- Practice method semantics table (safe/idempotent).
- Avoid verbs in path.
Most Important Sources
- https://roy.gbiv.com/untangled
- https://www.rfc-editor.org/rfc/rfc9110
- https://learn.microsoft.com/azure/architecture/best-practices/api-design