Sponsored Links
-->

Sunday, April 8, 2018

REST Web Services 08 - HATEOAS - YouTube
src: i.ytimg.com

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 that application servers provide dynamically entirely through hypermedia. A REST client needs no prior knowledge about how to interact with an application or server beyond a generic understanding of hypermedia.

By contrast, clients and servers in some service-oriented architectures (SOA) interact through a fixed interface shared through documentation or an interface description language (IDL).

The way that the HATEOAS constraint decouples client and server enables the server functionality to evolve independently.


Video HATEOAS



Details

A REST client enters a REST application through a simple fixed URL. All future actions the client may take are discovered within resource representations returned from the server. The media types 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.

For example, this GET request fetches an account resource, requesting details in an XML representation:

The response is:

The response contains these possible follow-up links: make a deposit, withdrawal, or transfer, or close the account.

When the account information is retrieved later, the account is overdrawn:

Now only one link is available: to deposit more money. In its current state, the other links are not available. Hence the term Engine of Application State. What actions are possible vary 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.


Maps HATEOAS



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".


HYPERMEDIA APIS: THE BENEFITS OF HATEOAS #APIs | APIs | Pinterest ...
src: i.pinimg.com


Implementations

  • Spring HATEOAS, part of the Spring Framework
  • Yii 2 Framework REST API supports HATEOAS, part of the Yii Framework (since version 2.0)
  • Jersey API supports HATEOAS
  • Tastypie supports HATEOAS
  • Eve supports HATEOAS
  • Apigility, API builder based on Zend Framework 2, supports HATEOAS
  • Hateoas PHP library, supports HATEOAS REST Web Services implementations.
  • API Platform, PHP framework based on hypermedia and Linked Data support with JSON-LD, Schema.org and Hydra
  • AtomGraph Processor, a Java backend for building declarative, read-write Linked Data applications, supports HATEOAS Linked Data
  • Symfony Framework supports HATEOAS with willdurand/Hateoas
  • WSO2 Governance REST API, supports HATEOAS based hypermedia and Linked Data.

What is HATEOAS in REST? | Spring MVC, Spring Boot Example | Tech ...
src: i.ytimg.com


See also

  • Hypertext Application Language
  • Universal Description Discovery and Integration is the equivalent for the Web Services Description Language

REST API Design. Application API API = Application Programming ...
src: images.slideplayer.com


References

Source of article : Wikipedia