6.1 & 6.2 HTTP Fundamentals & Architectural Constraints of REST
REST (Representational State Transfer) is an architectural style formulated by Roy Fielding (2000) for distributed hypermedia systems. It treats every component as a Resource identified by a uniform URI and manipulated via standard HTTP verbs.
Six Guiding Architectural Constraints of REST:
- 1. Client-Server Separation: Decouples user interface concerns from data storage concerns, improving portability and scalability.
- 2. Statelessness: Every request from client to server must contain all information necessary to understand and process the request; server stores no client session context.
- 3. Cacheability: Responses must explicitly define themselves as cacheable or non-cacheable (via
Cache-Control,ETag) to reduce network latency. - 4. Uniform Interface: The cornerstone constraint consisting of: Resource identification in requests (URIs), Resource manipulation through representations (JSON/XML), Self-descriptive messages (MIME types), and HATEOAS (Hypermedia as the Engine of Application State).
- 5. Layered System: Architecture allows intermediaries (proxies, load balancers, API gateways, security firewalls) without client awareness.
- 6. Code-on-Demand (Optional): Servers can extend client functionality by transmitting executable code (e.g., JavaScript).