What is REST? Part 1: RESTful architectures
What is REST? Part 1: RESTful architectures
Roy Fielding, one of the principal authors behind the HTTP specification, wrote a dissertation laying out the theoretical foundation for REST. Based on his work, this article takes a look at the motivation behind REST, as well as its primary fundamental principles.
REST as an Architectural Style for the Modern Web
The famous academic work by Roy Fielding is called “Architectural Styles and the Design of Network-based Software Architectures.” In the abstract, Fielding introduced REST as an architectural style for design and development on the modern Web.
The term “REpresentational State Transfer” is derived from the properties of the generic interface used for communication. We’ll be going deeper into those details in a later blog article. For now, we’ll be focusing on the term “architectural style.” Fielding’s definition of an architectural style is:
An architectural style is a coordinated set of architectural constraints that restricts the roles/features of architectural elements and the allowed relationships among those elements within any architecture that conforms to that style.
Here, the word “constraints” can also be understood to be “properties.” Thus, REST is an architectural style and describes the properties in the elements of (modern) web architecture.
Hypermedia is the Focus
When it comes to REST, hypermedia is of central importance. In the very first sentence of his dissertation, Fielding describes how the success of the Web can largely be explained by its attribute of being a distributed hypermedia system:
The World Wide Web has succeeded in large part because its software architecture has been designed to meet the needs of an Internet-scale distributed hypermedia system.
For Fielding, the terms “(modern) Web” and “(distributed) hypermedia” are inseparable. REST is therefore an architectural style for an (Internet-scaled) distributed hypermedia system (i.e. a Web).
You won’t find clarification for the term “hypermedia” anywhere in the dissertation. This may be one of the reasons why REST is so often misunderstood. It wasn’t until a later blog article that Fielding explained what he meant with hypertext (synonymous with hypermedia):
When I say hypertext, I mean the simultaneous presentation of information and controls such that the information becomes the affordance through which the user (or automaton) obtains choices and selects actions.
In today’s Web, we are met with hypermedia on a daily basis by clicking a link on one webpage that forwards us to another, or by opening a document via a link. In this context, hypermedia is about linking information on the Web.
Fielding views hypermedia as a simple generic user interface that allows complex relationships between information to be mapped via links, regardless of the information source and its physical location (e.g. database or webpage, local machine or remote web server).
Motivation
The Web was created in 1989 in a research project at CERN. The researchers developed the first specifications for HTTP, URL and HTML. There were a lot of ideas for enhancing the Web. Numerous enhancements were created. What was missing was a uniform strategy. It quickly became clear that the successful development of the Web would be virtually impossible without standardization.
With REST, they were looking to develop a standard to describe the way the Web works and serve as a framework for developing Web protocols:
(…) the motivation for developing REST was to create an architectural model for how the Web should work, such that it could serve as the guiding framework for the Web protocol standards. REST has been applied to describe the desired Web architecture, help identify existing problems, compare alternative solutions, and ensure that protocol extensions would not violate the core constraints that make the Web successful.
6 Constraints of REST
According to Fielding, REST-compatible architecture should have the following constraints:
Architecture is REST-compatible (i.e. RESTful) when constraints 1 to 5 are met. Fielding refers to this as Uniform-Layered-Client-Cache-Stateless-Server.
Summary
Author: Nicolai Zaidman
Can we support you? Contact our Experts!
With WAVESTONE, you have a strong partner at your side.
We look forward to your challenge!