Defining a RESTful Framework
Web application frameworks have varying support for the concepts behind Representational State Transfer (REST). Most web application frameworks, if not all, allow you to create “fully” RESTful web applications. However, there does not seem to be a focus on explicitly applying RESTful principles. So, here are the key concepts that I’d like to see addressed:
- Embrace, and don’t abstract, the Hypertext Transfer Protocol (HTTP).
- Focus on entities/resources—identified by full Uniform Resource Identifiers (URIs).
- Use HTTP methods (GET, POST, PUT, DELETE, OPTIONS, HEAD) to perform operations on entities/resources.
- Allow for self-described messages through the use of header fields, such as Accept and Content-Type.
- Make hypermedia controls a core concept (perhaps using PHACTOR as a starting point), not just a byproduct of rendering.
- Think of web applications as state transition systems. Representations of entities/resources are states, and hypermedia controls define the available state transitions.
- Interoperability: Focusing on open standards allows for easier integration with other systems.
- Cacheability: Embracing HTTP gives you many caching options, almost for free.
- Testability: Self-contained and self-describing messages are very testable. Decomposing a complex system into states and available state transitions greatly reduces the complexity of the system and its tests.