REST provides a set of architectural constraints that, when applied as a whole, emphasizes scalability of component interactions, generality of interfaces, independent deployment of components, and intermediary components to reduce interaction latency, enforce security, and encapsulate legacy systems.
Roy Fielding’s doctoral dissertation surveys architectural styles for building networked hypermedia systems and introduces the REST architectural style. Fielding was one of the original architects of the web and his dissertation attempts to describe “the model for how the modern Web should work”.
Designing web applications is a complex task. Each application has a number of requirements and there is a huge range of possible approaches and toolkits available to help software engineers meet those requirements.
Fielding surveys architectural styles, a very high level of abstraction describing the bits of a running networked system and how they fit together. He then describes REST, a style designed to maximise the required properties of a networked hypermedia system (i.e. a world-wide web). It’s almost like a memoir of the construction of the web, an explanation of rationale.
The REST style is incredibly elegant. It simplifies so much that it almost seems invisible.
- Resources are named by urls.
- The big 4 HTTP methods
DELETEare the only operations used on resources.
- Systems are built as clients, servers and connectors (proxies, caches, etc) speaking a common protocol, HTTP.
The properties introduced by these constraints are:
- Performance, both absolute and user-perceived.
These are obviously very nice properties for a system to have. Visibility is especially interesting and subtle. Use of the HTTP protocol’s simple verbs and request and response structures allows the effect of individual requests to be well-understood and verifiable and intermediate tools (such as caches, proxies or transforming middleware) to be constructed easily.
Writing to your reading list
If you are developing web applications, I recommend Fielding’s dissertation as a summary of styles and as a description of the REST style.
I also found the Wikipedia entry on REST very useful, particularly the grid of HTTP methods and their effects on various types of resource.
Stefan Tilkov has a nice article which lists some REST anti-patterns. It defines REST by subtracting what is not REST. An informative approach.
Finally, you may also be interested in Fielding’s presentation at Railsconf Europe last year, entitled “The rest of REST.”