Over a period of years lot of Web Architectural styles were introduced like, Pipe and filter, Uniform Pipe Filter and some hierarchical styles like client server, Client server stateless, cache, etc. But each style has equal strength and limitations which leads to a modern, scalable, stateless architectural style called REST which is widely adopted.
The Word REST is the Abbreviation of the Phase ‘Representational State Transfer’ is the Architectural Design Style introduced in year 2000 presentation by Roy Thomas Fielding one of the Co-founder of HTTP Specification. Web services that conform to the REST architectural style, called RESTful Web services, provide interoperability between computer systems on the internet.
REST is not a standard or Protocol. Its a style of architecting a Application. 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. The constraints are,
- Client-Server: Separation of Concern is the principle behind this constraint. Separating the user interface concerns from the data storage concerns, can improve the portability of the user interface across multiple platforms and improve scalability by simplifying the server components. Also it allows the components evolve independently.
- Stateless communication: Client Server communication should be stateless in nature. 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. This constraint induces the properties of visibility, reliability, and scalability.
- Uniform Interface: Implementations are decoupled from the services they provide, which encourages independent evolvability. The trade-off, though, is that a uniform interface degrades efficiency, since information is transferred in a standardized form rather than one which is specific to an application’s needs. The CRUD Operations Create, Read, Update, Delete are the key methods which is reused across all types of objects.
- Layered System: To improve behavior for Internet-scale requirements, layered system constraints is added. It 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.
REST Elements :
The key abstraction of information in REST is a resource. More precisely, a 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. The values in the set may be resource representations and/or resource identifiers. A resource can map to the empty set, which allows references to be made to a concept before any realization of that concept exist.
REST uses a resource identifier to identify the particular resource involved in an interaction between components. REST connectors provide a generic interface(CURD) for accessing and manipulating the value set of a resource, regardless of how the membership function is defined or the type of software that is handling the request.
A representation is a sequence of bytes, plus representation metadata to describe those bytes. Other commonly used but less precise names for a representation include: document, file, and HTTP message entity, instance, or variant.
Individual resources are identified in requests, for example using URIs in RESTful Web services. The resources themselves are conceptually separate from the representations that are returned to the client. For example, the server could send data from its database as HTML, XML or as JSON—none of which are the server’s internal representation.
REST Advantages :
- Granularity of the development process.
- Ubiquity of services and developers support.
- Discoverable data and services
- Resilient communications.
Watch this below Video to know about RAD Server for REST Delphi/C++ Builder Demonstration.