Konubinix' opinionated web of thoughts

REpresentational State Transfer

Fleeting

communication must be stateless in nature, as in the client-stateless-server (CSS) style of Section 3.4.3 (Figure 5-3), such that each request from client to server must contain all of the information necessary to understand the request, and cannot take advantage of any stored context on the server. Session state is therefore kept entirely on the client.

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

Visibility is improved because a monitoring system does not have to look beyond a single request datum in order to determine the full nature of the request. Reliability is improved because it eases the task of recovering from partial failures [133]. Scalability is improved because not having to store state between requests allows the server component to quickly free resources, and further simplifies implementation because the server doesn’t have to manage resource usage across requests.

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

central feature that distinguishes the REST architectural style from other network-based styles is its emphasis on a uniform interface between components

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

REST is defined by four interface constraints: identification of resources; manipulation of resources through representations; self-descriptive messages; and, hypermedia as the engine of application stat

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

, the layered system style allows an architecture to be composed of hierarchical layers by constraining component behavior such that each component cannot “see” beyond the immediate layer with which they are interacting

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

REST allows client functionality to be extended by downloading and executing code in the form of applets or scripts.

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

However, it also reduces visibility, and thus is only an optional constraint within REST.

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

the nature and state of an architecture’s data elements is a key aspect of REST

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

REST provides a hybrid of all three options by focusing on a shared understanding of data types with metadata, but limiting the scope of what is revealed to a standardized interface

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

The key abstraction of information in REST is a resource

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

any concept that might be the target of an author’s hypertext reference must fit within the definition of a resource

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

representation consists of data, metadata describing the data, and, on occasion, metadata to describe the metadata (usually for the purpose of verifying message integrity). Metadata is in the form of name-value pairs

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

Control data defines the purpose of a message between components, such as the action being requested or the meaning of a response

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

chapter introduces and elaborates the Representational State Transfer (REST) architec

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

constraints require that the data within a response to a request be implicitly or explicitly labeled as cacheable or non-cacheable

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

REST interface is designed to be efficient for large-grain hypermedia data transfer, optimizing for the common case of the Web, but resulting in an interface that is not optimal for other forms of architectural interaction

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

The final addition to our constraint set for REST comes from the code-on-demand style

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

REST consists of a set of architectural constraints chosen for the properties they induce on candidate architectures

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

REST ignores the details of component implementation and protocol syntax in order to focus on the roles of components, the constraints upon their interaction with other components, and their interpretation of significant data elements.

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

When a link is selected, information needs to be moved from the location where it is stored to the location where it will be used by, in most cases, a human reader. This is unlike many other distributed processing paradigms [6, 50], where it is possible, and usually more efficient, to move the “processing agent” (e.g., mobile code, stored procedure, search expression, etc.) to the data rather than move the data to the processor.

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

REST components communicate by transferring a representation of a resource in a format matching one of an evolving set of standard data types, selected dynamically based on the capabilities or desires of the recipient and the nature of the resource

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

the representation is in the same format as the raw source, or is derived from the source, remains hidden behind the interface.

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

information hiding through a generic interface to enable encapsulation and evolution of services

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

REST’s data elements are summarized in Table 5-1.

Table 5-1: REST Data Elements

Data Element Modern Web Examples

resource the intended conceptual target of a hypertext reference

resource identifier URL, URN

representation HTML document, JPEG image

representation metadata media type, last-modified time

resource metadata source link, alternates, vary

control data if-modified-since, cache-control

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

information that can be named can be a resource: a document or image, a temporal service (e.g. “today’s weather in Los Angeles”), a collection of other resources, a non-virtual object (e.g. a person), and so on.

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

resource R is a temporally varying membership function MR(t), which for time t maps to a set of entities, or values, which are equivalent

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

values in the set may be resource representations and/or resource identifiers

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

resource can map to the empty set, which allows references to be made to a concept before any realization of that concept exists

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

are two distinct resources, even if they both map to the same value at some point in time. The distinction is necessary so that both resources can be identified and referenced independently

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

similar example from software engineering is the separate identification of a version-controlled source code file when referring to the “latest revision”, “revision number 1.2.7”, or “revision included with the Orange release.”

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

connectors present an abstract interface for component communication, enhancing simplicity by providing a clean separation of concerns and hiding the underlying implementation of resources and communication mechanisms. The

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

Table 5-2: REST Connectors

Connector Modern Web Examples

client libwww, libwww-perl

server libwww, Apache API, NSAPI

cache browser cache, Akamai cache network

resolver bind (DNS lookup library)

tunnel SOCKS, SSL after HTTP CONNECT

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

All REST interactions are stateless

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

Table 5-3: REST Components

Component Modern Web Examples

origin server Apache httpd, Microsoft IIS

gateway Squid, CGI, Reverse Proxy

proxy CERN Proxy, Netscape Proxy, Gauntlet

user agent Netscape Navigator, Lynx, MOMspider

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

user agent uses a client connector to initiate a request and becomes the ultimate recipient of the response. The most common example is a Web browser, which provides access to information services and renders service responses according to the application needs

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

origin server uses a server connector to govern the namespace for a requested resource. It is the definitive source for representations of its resources and must be the ultimate recipient of any request that intends to modify the value of its resources. Each origin server provides a generic interface to its services as a resource hierarchy. The resource implementation details are hidden behind the interface

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

proxy component is an intermediary selected by a client to provide interface encapsulation of other services, data translation, performance enhancement, or security protection

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

gateway (a.k.a., reverse proxy) component is an intermediary imposed by the network or origin server to provide an interface encapsulation of other services, for data translation, performance enhancement, or security enforcement

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

difference between a proxy and a gateway is that a client determines when it will use a proxy.

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

application state is controlled and stored by the user agent and can be composed of representations from multiple servers

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

The model application is therefore an engine that moves from one state to the next by examining and choosing from among the alternative state transitions in the current set of representations

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

Requests and responses have the appearance of a remote invocation style, but REST messages are targeted at a conceptual resource rather than an implementation identifier.

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

REST works well because it does not limit the implementation of resources to certain predefined models, allowing each application to choose an implementation that best matches its own needs and enabling the replacement of implementations without impacting the user

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

The interaction method of sending representations of resources to consuming components has some parallels with event-based integration (EBI) styles. The key difference is that EBI styles are push-based. The component containing the state (equivalent to an origin server in REST) issues an event whenever the state changes, whether or not any component is actually interested in or listening for such an event

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

REST style, consuming components usually pull representations. Although this is less efficient when viewed as a single client wishing to monitor a single resource, the scale of the Web makes an unregulated push model infeasible

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

REST provides a set of architectural constraints that, when applied as a whole, emphasizes scalability of component interactions, generality of interfaces, independent deployment of components, and intermediary components to reduce interaction latency, enforce security, and encapsulate legacy systems

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

REST was originally referred to as the “HTTP object model,” but that name would often lead to misinterpretation of it as the implementation model of an HTTP server.

https://www.ics.uci.edu/~fielding/pubs/dissertation/evaluation.htm

name “Representational State Transfer” is intended to evoke an image of how a well-designed Web application behaves: a network of web pages (a virtual state-machine), where the user progresses through the application by selecting links (state transitions), resulting in the next page (representing the next state of the application) being transferred to the user and rendered for their use.

https://www.ics.uci.edu/~fielding/pubs/dissertation/evaluation.htm

Forcing the interface definitions to match the interface requirements causes the protocols to seem vague, but that is only because the interface being manipulated is only an interface and not an implementation. The protocols are specific about the intent of an application action, but the mechanism behind the interface must decide how that intention affects the underlying implementation of the resource mapping to representations.

https://www.ics.uci.edu/~fielding/pubs/dissertation/evaluation.htm

Information hiding is one of the key software engineering principles that motivates the uniform interface of REST. Because a client is restricted to the manipulation of representations rather than directly accessing the implementation of a resource, the implementation can be constructed in whatever form is desired by the naming authority without impacting the clients that may use its representations.

https://www.ics.uci.edu/~fielding/pubs/dissertation/evaluation.htm

Many different resources could map to the same representation, while other resources may have no representation mapped at all.

https://www.ics.uci.edu/~fielding/pubs/dissertation/evaluation.htm

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

A resource does not always map to a singular file, but all resources that are not static are derived from some other resources, and by following the derivation tree an author can eventually find all of the source resources that must be edited in order to modify the representation of a resource

https://www.ics.uci.edu/~fielding/pubs/dissertation/evaluation.htm

The resource is not the storage object

https://www.ics.uci.edu/~fielding/pubs/dissertation/evaluation.htm

The resource is a conceptual mapping – the server receives the identifier (which identifies the mapping) and applies it to its current mapping implementation (usually a combination of collection-specific deep tree traversal and/or hash tables) to find the currently responsible handler implementation and the handler implementation then selects the appropriate action+response based on the request content

https://www.ics.uci.edu/~fielding/pubs/dissertation/evaluation.htm

there are no resources on the server; just mechanisms that supply answers across an abstract interface defined by resources

https://www.ics.uci.edu/~fielding/pubs/dissertation/evaluation.htm

Cookies also violate REST because they allow data to be passed without sufficiently identifying its semantics, thus becoming a concern for both security and privacy. The combination of cookies with the Referer [sic] header field makes it possible to track a user as they browse between sites.

https://www.ics.uci.edu/~fielding/pubs/dissertation/evaluation.htm

Likewise, the use of cookies to identify a user-specific “shopping basket” within a server-side database could be more efficiently implemented by defining the semantics of shopping items within the hypermedia data formats, allowing the user agent to select and store those items within their own client-side shopping basket, complete with a URI to be used for check-out when the client is ready to purchase.

https://www.ics.uci.edu/~fielding/pubs/dissertation/evaluation.htm

, placing the application state on the client-side reduces the server’s control over consistent application behavior, since the application becomes dependent on the correct implementation of semantics across multiple client versions

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

REST is defined by four interface constraints: identification of resources; manipulation of resources through representations; self-descriptive messages; and, hypermedia as the engine of application stat

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

  • Hateoas

REST components perform actions on a resource by using a representation to capture the current or intended state of that resource and transferring that representation between components

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

  • Hateoas : the hypermedia os the way the state is communicated from the client to the server

REST concentrates all of the control state into the representations received in response to interactions. The goal is to improve server scalability by eliminating any need for the server to maintain an awareness of the client state beyond the current request. An application’s state is therefore defined by its pending requests, the topology of connected components (some of which may be filtering buffered data), the active requests on those connectors, the data flow of representations in response to those requests, and the processing of those representations as they are received by the user agent.

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

  • Hateoas ?

Since REST-based architectures communicate primarily through the transfer of representations of resources, latency can be impacted by both the design of the communication protocols and the design of the representation data formats. The ability to incrementally render the response data as it is received is determined by the design of the media type and the availability of layout information (visual dimensions of in-line objects) within each representation.

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

most efficient network request is one that doesn’t use the network.

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

next control state of an application resides in the representation of the first requested resource, so obtaining that first representation is a priority. REST interaction is therefore improved by protocols that “respond first and think later.”

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

application state is controlled and stored by the user agent and can be composed of representations from multiple servers

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

  • The state is user agent’s business and may even overlap several servers ontologies

allows the user to directly manipulate the state (e.g., a Web browser’s history), anticipate changes to that state (e.g., link maps and prefetching of representations), and jump from one application to another (e.g., bookmarks and URI-entry dialogs).

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

model application is therefore an engine that moves from one state to the next by examining and choosing from among the alternative state transitions in the current set of representations. Not surprisingly, this exactly matches the user interface of a hypermedia browser.

https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

  • Hateoas. It dpes not say that the server rrsppnds with the lonks

application state (the set of currently rendered representations)

https://www.ics.uci.edu/~fielding/pubs/dissertation/evaluation.htm

A Web API (or Web Service) conforming to the REST architectural style is a REST API.

https://restfulapi.net/

Identification of resources – The interface must uniquely identify each resource involved in the interaction between the client and the server.

https://restfulapi.net/

Manipulation of resources through representations – The resources should have uniform representations in the server response. API consumers should use these representations to modify the resources state in the server.

https://restfulapi.net/

Self-descriptive messages – Each resource representation should carry enough information to describe how to process the message. It should also provide information of the additional actions that the client can perform on the resource

https://restfulapi.net/

Hypermedia as the engine of application state – The client should have only the initial URI of the application. The client application should dynamically drive all other resources and interactions with the use of hyperlinks.

https://restfulapi.net/

client application must entirely keep the session state.

https://restfulapi.net/

a response should implicitly or explicitly label itself as cacheable or non-cacheable

https://restfulapi.net/

composed of hierarchical layers by constraining component behavior.

https://restfulapi.net/

Servers can provide part of features delivered to the client in the form of code, and the client only needs to execute the code

https://restfulapi.net/

Any information that we can name can be a resource

https://restfulapi.net/

The state of the resource, at any particular time, is known as the resource representation

https://restfulapi.net/

The resource representations are consist of:the datathe metadata describing the dataand the hypermedia links that can help the clients in transition to the next desired state

https://restfulapi.net/

A REST API consists of an assembly of interlinked resources. This set of resources is known as the REST API’s resource model

https://restfulapi.net/

Hypertext (or hypermedia) means 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.Remember that hypertext does not need to be HTML (or XML or JSON) on a browser. Machines can follow links when they understand the data format and relationship types.— Roy Fielding

https://restfulapi.net/

Roy: I talk about it because the initial reaction to using REST for machine-to-machine interaction is almost always of the form “we don’t see a reason to bother with hypermedia — it just slows down the interactions, as opposed to the client knowing directly what to send.” The rationale behind decoupling for evolvability is simply not apparent to developers who think they are working towards a modest goal, like “works next week” or “we’ll fix it in the next release”.

If developers can conceive of their systems being used for a much longer time, then we can escape their own preconceptions about how it will need to change over time. We can then work back from decades to years (how long until you don’t know your users?) or even months (how long until you’ve lost control over client deployment?).

https://www.infoq.com/articles/roy-fielding-on-versioning/

hypermedia as the engine of application state" is a REST constraint. Not an option. Not an ideal. Hypermedia is a constraint. As in, you either do it or you aren’t doing REST. You can’t have evolvability if clients have their controls baked into their design at deployment. Controls have to be learned on the fly. That’s what hypermedia enables.

https://www.infoq.com/articles/roy-fielding-on-versioning/

Hypermedia allows application controls to be supplied on demand, but we also need to be able to adapt the clients’ understanding of representations (understanding of media types and their expected processing). That is where code-on-demand shines.

https://www.infoq.com/articles/roy-fielding-on-versioning/

REST must be the most broadly misused technical term in computer programming history

https://htmx.org/essays/how-did-rest-come-to-mean-the-opposite-of-rest/

Along with scrum !

You can tap the sign as much as you want, that battle was lost a long time ago. REST is just the common term people use for HTTP+JSON RPC

https://news.ycombinator.com/item?id=32073545

Roy Fielding’s Misappropriated REST Dissertation

with this Hacker News poster:

I’ve read several articles about REST, even a bit of the original paper. But I still have quite a vague idea about what it is. I’m beginning to think that nobody knows, that it’s simply a very poorly defined concept.

https://twobithistory.org/2020/06/28/rest.html

After reading Fielding’s dissertation, I realized that the much more interesting story here is how Fielding’s ideas came to be so widely misunderstood.

https://twobithistory.org/2020/06/28/rest.html

Fielding’s dissertation (titled “Architectural Styles and the Design of Network-based Software Architectures”) is not about how to build APIs on top of HTTP but rather about HTTP itself.

https://twobithistory.org/2020/06/28/rest.html

his dissertation presents REST as a distillation of the architectural principles that guided the standardization process for HTTP/1.1. Fielding used these principles to make decisions about which proposals to incorporate into HTTP/1.1

https://twobithistory.org/2020/06/28/rest.html

Fielding also felt that cookies are not RESTful because they add state to what should be a stateless system, but their usage was already entrenched

https://twobithistory.org/2020/06/28/rest.html

REST, for Fielding, was not a guide to building HTTP-based systems but a guide to extending HTTP.

https://twobithistory.org/2020/06/28/rest.html

Fielding establishes this taxonomy to emphasize that different constraints are appropriate for different applications and that this last group of constraints were the ones he felt worked best for HTTP.

https://twobithistory.org/2020/06/28/rest.html

deep, deep irony of REST’s ubiquity today. REST gets blindly used for all sorts of networked applications now, but Fielding originally offered REST as an illustration of how to derive a software architecture tailored to an individual application’s particular needs.

https://twobithistory.org/2020/06/28/rest.html

He warns, almost at the very beginning of the dissertation, that “design-by-buzzword is a common occurrence” brought on by a failure to properly appreciate software architecture

https://twobithistory.org/2020/06/28/rest.html

He picks up this theme again several pages later:

Some architectural styles are often portrayed as “silver bullet” solutions for all forms of software. However, a good designer should select a style that matches the needs of a particular problem being solved.5

https://twobithistory.org/2020/06/28/rest.html

Fielding later points out, it incorporates trade-offs that may not be appropriate unless you are building a distributed hypermedia application:

REST is designed to be efficient for large-grain hypermedia data transfer, optimizing for the common case of the Web, but resulting in an interface that is not optimal for other forms of architectural interaction.6

https://twobithistory.org/2020/06/28/rest.html

The constraints that REST imposes were carefully chosen to solve this anarchic scalability problem. Web service APIs that are public-facing have to deal with a similar problem, so one can see why REST is relevant there.

https://twobithistory.org/2020/06/28/rest.html

Yet today it would not be at all surprising to find that an engineering team has built a backend using REST even though the backend only talks to clients that the engineering team has full control over.

https://twobithistory.org/2020/06/28/rest.html

given that Fielding’s dissertation was all about avoiding silver bullet software architectures, how did REST become a de facto standard for web services of every kind?

https://twobithistory.org/2020/06/28/rest.html

Adopting REST’s constraints makes some sense, especially for public-facing APIs that do cross organizational boundaries and thus benefit from REST’s “uniform interface.”

https://twobithistory.org/2020/06/28/rest.html

Fielding’s dissertation (titled “Architectural Styles and the Design of Network-based Software Architectures”) is not about how to build APIs on top of HTTP but rather about HTTP itself.

https://twobithistory.org/2020/06/28/rest.html

you could sum up the part of the dissertation where Fielding introduces REST as, essentially, “Listen, we just designed HTTP, so if you also find yourself designing a distributed hypermedia system you should use this cool architecture we worked out called REST to make things easier.”

https://twobithistory.org/2020/06/28/rest.html

Fielding makes clear that REST is intended as a solution for the scalability and consistency problems that arise when trying to connect hypermedia across the internet, not as an architectural model for distributed applications in general.

https://twobithistory.org/2020/06/28/rest.html

Having a standard mapping of HTTP verbs to CRUD actions is a useful thing, but this standard mapping is part of FIOH and not part of REST.

https://twobithistory.org/2020/06/28/rest.html

FIOH api

could have called their approach Fuck It, Overload HTTP (FIOH)

https://twobithistory.org/2020/06/28/rest.html

usage ordinaire du mot API REST

Dès qu’il y a des ressources en jeu, on parle d’API rest.

Je décide de préférer parler d’API web.

Notes pointant ici