HATEOAS, an abbreviation for
Hypermedia as the Engine of Application State, is a constraint of the
REST application architectureRepresentational state transfer is a style of software architecture for distributed hypermedia systems such as the World Wide Web. The term representational state transfer was introduced and defined in 2000 by Roy Fielding in his doctoral dissertation...
that distinguishes it from most other network application architectures. The principle is that a client interacts with a network application entirely through
hypermediaHypermedia is a computer-based information retrieval system that enables a user to gain or provide access to texts, audio and video recordings, photographs and computer graphics related to a particular subject.Hypermedia is a term created by Ted Nelson....
provided dynamically by application servers. A REST client needs no prior knowledge about how to interact with any particular application or server beyond a generic understanding of hypermedia. Contrast this with e.g. a
service-oriented architectureIn software engineering, a Service-Oriented Architecture is a set of principles and methodologies for designing and developing software in the form of interoperable services. These services are well-defined business functionalities that are built as software components that can be reused for...
(SOA), where clients and servers interact through a fixed
interfaceIn the field of computer science, an interface is a tool and concept that refers to a point of interaction between components, and is applicable at the level of both hardware and software...
shared through documentation or an
interface description languageAn interface description language , or IDL for short, is a specification language used to describe a software component's interface...
(IDL).
The HATEOAS constraint serves to decouple client and server in a way that allows the server to evolve functionality independently.
Details
A REST client enters a REST application through a simple fixed
URLIn computing, a uniform resource locator or universal resource locator is a specific character string that constitutes a reference to an Internet resource....
. All future actions the client may take are discovered within
resourceThe concept of resource is primitive in the Web architecture, and is used in the definition of its fundamental elements. The term was first introduced to refer to targets of Uniform Resource Locators , but its definition has been further extended to include the referent of any Uniform Resource...
representations returned from the server. The
media typesAn Internet media type, originally called a MIME type after MIME and sometimes a Content-type after the name of a header in several protocols whose value is such a type, is a two-part identifier for file formats on the Internet.The identifiers were originally defined in RFC 2046 for use in email...
used for these representations, and the link relations they may contain, are standardized. The client transitions through application states by selecting from the links within a representation or by manipulating the representation in other ways afforded by its media type. In this way, RESTful interaction is driven by hypermedia, rather than out-of-band information.
A client does not need to understand every media type and communication mechanism offered by the server and this understanding may be improved on the fly through "code-on-demand" provided to the client by the server.
Origins
The HATEOAS constraint is an essential part of the "uniform interface" feature of REST, as defined in Roy Fielding's doctoral dissertation. Fielding has further described the concept on his blog.
The purpose of some of the strictness of this and other REST constraints, Fielding explains, is "software design on the scale of decades: every detail is intended to promote software longevity and independent evolution. Many of the constraints are directly opposed to short-term efficiency. Unfortunately, people are fairly good at short-term design, and usually awful at long-term design."