What is REST?

REST stands for REpresentational State Transfer, a term coined by Dr. Roy Fielding in his seminal work Architectural Styles and the Design of Network-based Software Architectures. In a nutshell, it is an architectural style for building applications for the Web.

Firstly, REST is based on a Client-Server style which is widespread in network-based systems, and one of its main virtues is separation of concerns that can lead to the simplification of the server component’s implementation. Secondly, the server side of an application built using REST style is stateless, while all the state is maintained by a client and sent to the server when necessary. For example, if a customer browses a store data, the information may be paginated and when the customer presses the “next” button, client informs the server what page number it wants to see in contrast to the situation when the server stores the context information of its interaction with a client. The upside of such an approach could be improved scalability, as there is no overhead of session management and replication. The flip side is increased network traffic due to repetitive data transmission. Thirdly, this style stresses cache  usage for performance improvement. Fourthly, REST applications are layered, in other words such setup allow for intermediaries such as proxies and inverse proxies in order to improve performance. Finally, the gist of the REST architectural style is reliance on a uniform interface, a concept that will be discussed in a separate post. In addition, some code, such as script, may optionally be sent to a client to extend its functionality.

What is in the acronym?

The key concept of the style is a notion of a resource which is an abstract concept, for example, the aforementioned thesis. There could be a various representation of a resource - a text one or audio, in other words a representation is a sequence of bytes which is an instance of the thesis in a specific format along with metadata describing what the format is. A representation can be accessed by the client, or transferred to a client in REST lingo, using a handle which is a resource identifier, that is a resource identifier is an interface via which a representation could be summoned by clients. In the process content negotiation could be employed to obtain data in correct format or alternatively of particular media type.

To explain what is a Representational State transform Dr. Fielding uses a metaphor of a user progressing through a Web application. The user follows the link and various pages are displayed to her, each page is like a state of the application. Each click is like a state change which result in rendering of the next page or, in other words, a new state of the application, which includes transfer of a representation of a resource, that is the state of the application. A representation of the next state of the application is transferred to the user with each click.


Popular posts from this blog

Getting started with Dropwizard: Connecting to a Database using Hibernate

Getting Started with Dropwizard: Authentication, Configuration and HTTPS

Getting started with Dropwizard: First steps