HOME

TheInfoList



OR:

Hypermedia as the Engine of Application State (HATEOAS) is a constraint of the REST application architecture that distinguishes it from other network application architectures. With HATEOAS, a client interacts with a network application whose application servers provide information dynamically through
hypermedia Hypermedia, an extension of the term hypertext, is a nonlinear medium of information that includes graphics, audio, video, plain text and hyperlinks. This designation contrasts with the broader term ''multimedia'', which may include non-interac ...
. A REST client needs little to no prior knowledge about how to interact with an application or server beyond a generic understanding of hypermedia. By contrast, clients and servers in Common Object Request Broker Architecture (CORBA) interact through a fixed
interface Interface or interfacing may refer to: Academic journals * ''Interface'' (journal), by the Electrochemical Society * ''Interface, Journal of Applied Linguistics'', now merged with ''ITL International Journal of Applied Linguistics'' * '' Inte ...
shared through documentation or an
interface description language interface description language or interface definition language (IDL), is a generic term for a language that lets a program or object written in one language communicate with another program written in an unknown language. IDLs describe an inter ...
(IDL). The restrictions imposed by HATEOAS decouple client and server. This enables server functionality to evolve independently.


Example

A user-agent that implements HTTP makes an HTTP request of a REST API through a simple
URL A Uniform Resource Locator (URL), colloquially termed as a web address, is a reference to a web resource that specifies its location on a computer network and a mechanism for retrieving it. A URL is a specific type of Uniform Resource Identifie ...
. All subsequent requests the user-agent may make are discovered inside the responses to each request. The
media type A media type (also known as a MIME type) is a two-part identifier for file formats and format contents transmitted on the Internet. The Internet Assigned Numbers Authority (IANA) is the official authority for the standardization and publication o ...
s used for these representations, and the
link relation A link relation is a descriptive attribute attached to a hyperlink in order to define the type of the link, or the relationship between the source and destination resources. The attribute can be used by automated systems, or can be presented to a u ...
s 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. For example, this GET request fetches an account resource, requesting details in a JSON representation: GET /accounts/12345 HTTP/1.1 Host: bank.example.com The response is: HTTP/1.1 200 OK The response contains these possible follow-up links: POST a deposit, withdrawal, transfer, or close request (to close the account). As an example, later, after the account has been overdrawn, there is a different set of available links, because the account is overdrawn. HTTP/1.1 200 OK Now only one link is available: to deposit more money (by POSTing to deposits). In its current ''state'', the other links are not available. Hence the term ''Engine of Application State''. What actions are possible varies as the state of the resource varies. A client does not need to understand every media type and communication mechanism offered by the server. The ability to understand new media types can be acquired at run-time 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 Roy Thomas Fielding (born 1965) is an American computer scientist, one of the principal authors of the HTTP specification and the originator of the Representational State Transfer (REST) architectural style. He is an authority on computer network ...
'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".


Implementations

*
HAL HAL may refer to: Aviation * Halali Airport (IATA airport code: HAL) Halali, Oshikoto, Namibia * Hawaiian Airlines (ICAO airline code: HAL) * HAL Airport, Bangalore, India * Hindustan Aeronautics Limited an Indian aerospace manufacturer of fight ...
*
JSON-LD JSON-LD (JavaScript Object Notation for Linked Data) is a method of encoding linked data using JSON. One goal for JSON-LD was to require as little effort as possible from developers to transform their existing JSON to JSON-LD. JSON-LD allows data ...
*
Siren Siren or sirens may refer to: Common meanings * Siren (alarm), a loud acoustic alarm used to alert people to emergencies * Siren (mythology), an enchanting but dangerous monster in Greek mythology Places * Siren (town), Wisconsin * Siren, Wisco ...
* Collection+JSON * JSON:API *
Hydra Hydra generally refers to: * Lernaean Hydra, a many-headed serpent in Greek mythology * ''Hydra'' (genus), a genus of simple freshwater animals belonging to the phylum Cnidaria Hydra or The Hydra may also refer to: Astronomy * Hydra (constel ...


See also

*
Hypertext Application Language Hypertext Application Language (HAL) is an Internet Draft (a "work in progress") standard convention for defining hypermedia such as links to external resources within JSON or XML code (however, the latest version of HAL Internet-Draft expired on ...
*
Universal Description Discovery and Integration Web Services Discovery provides access to software systems over the Internet using standard protocols. In the most basic scenario there is a ''Web Service Provider'' that publishes a service and a ''Web Service Consumer'' that uses this service. ...
is the equivalent for the
Web Services Description Language The Web Services Description Language (WSDL ) is an XML-based interface description language that is used for describing the functionality offered by a web service. The acronym is also used for any specific WSDL description of a web service (also ...


References

{{reflist Distributed computing Hypermedia