Middle
What are the rules of REST architecture that you know?
sobes.tech AI
Answer from AI
- Client-Server Architecture: Clear separation of responsibilities between the client requesting resources and the server providing them.
- Stateless: Each request from the client to the server must contain all the information needed to understand and process the request. The server does not store information about previous client requests.
- Cacheability: Responses from the server can be marked as cacheable or non-cacheable, allowing clients to reuse responses to improve performance.
- Uniform Interface: Four constraints:
- Identification of resources: Resources are identified using URIs.
- Manipulation of resources through representations: The client interacts with a resource through its representations.
- Self-descriptive messages: Each message contains enough information to understand how to process it (e.g., content type).
- HATEOAS (Hypermedia as the Engine of Application State): The client transitions between resources by following links in server responses.
- Layered System: The architecture allows for intermediate layers (e.g., proxies, gateways) between the client and server without affecting their interaction.
- Code on Demand (Optional): The server can temporarily extend or customize the client's functionality by transferring executable code (e.g., JavaScript). This is an optional constraint.