Representational State Transfer

Overview#

Representational State Transfer or REST is an Software Architecture Model that sets certain constraints for designing and building large-scale distributed hypermedia systems. Representational State Transfer is often, improperly, used only as a API transport over HTTPAs an architectural style, Representational State Transfer has very broad application. The designs of both HTTP 1.1 and also URIs follow RESTful principles.

The World Wide Web is no doubt the largest and best known REST application. Many other web services also follow the REST architectural style. Examples include OAuth 2.0 and OpenID Connect 1.0.

Representational State Transfer objects are defined as addressable URIs, and are typically interacted with using the built-in verbs or HTTP Method — specifically, GET, PUT, DELETE, POST, etc. Representational State Transfer was defined by Roy Fielding in his 2000 PhD dissertation "Architectural Styles and the Design of Network-based Software Architectures" [2]

Representational State Transfer Data Elements#

Data ElementModern Web Examples
resourcethe intended conceptual target of a hypertext reference
resource identifierURL, URN
representationHTML document, JPEG image
representation metadatamedia type, last-modified time
resource metadatasource link, alternates, vary
control dataif-modified-since, Cache-Control

Representational State Transfer is stateless#

All REST interactions are stateless. That is, each request contains all of the information necessary for a connector to understand the request, independent of any requests that may have preceded it. This restriction accomplishes four functions:

REST APIs MUST be hypertext-driven [3]#

API designers, please note the following rules before calling your creation a REST API: In Representational State Transfer, Hypermedia As The Engine Of Application State (HATEOAS) is an architecture constraint in which the client interacts with hypermedia links, rather than through a specific interface. With REST, the core concept is that everything is a resource. While REST was a great solution when it was first proposed, there are some pretty significant issues that the architecture suffers from.

REST’s defining feature is the ability to reference resources — the problem is when those resources are complicated and relational in a more complex organization known as a graph. Fetching these complicated graphs may require multiple round-trips between the client and server.

What this ultimately results in is a system where the more useful it is, the slower it is. In other words, as more relational data is presented, the REST system chokes on itself.

GraphQL#

More Information#

There might be more information for this subject on one of the following: