REST API - REST Architectural Elements

The Representational State Transfer (REST) style is an abstraction of the architectural elements within a distributed hypermedia system. 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. 

It encompasses the fundamental constraints upon components, connectors, and data that define the basis of the Web architecture, and thus the essence of its behavior as a network-based application. REST distinguishes three classes of architectural elements, they are:
  • Connectors 
  • Components 
  • Data Elements


Connectors represent the activities involved in accessing resources and transferring representations. Roles provide an interface for components to implement. REST encapsulates different activities of accessing and transferring representations into different connector types. The table below summarizes the connector types:

Connector TypeDescriptionExample
ClientSending requests, receiving responses.HTTP library
ServerListening for requests, sending responses.Web Server API
CacheCan be located at the client or server connector to save cacheable responses, can also be shared between several clientsBrowser cache
ResolverTransforms resource identifiers into network addresses.bind (DNS lookup library)
TunnelRelays requests, any component can switch from active behavior to a tunnel behavior.SOCKS, SSL after HTTP CONNECT


In REST, the various software that interacts with one another are called components. They are categorized by roles summarized in the table below:
Component RoleDescriptionExample
Origin ServerUses a server connector to receive the request, and is the definitive source for representations of its resources. Each server provides a generic interface to its services as a resource hierarchy.Apache httpd, Microsoft IIS
User AgentUses a client connector to initiate a request and becomes the ultimate recipient of the response.Browser like Netscape Navigator etc
GatewayAct as both, client and server in order to forward - with possible translation - requests and responses.Squid, CGI, Reverse Proxy
ProxyCERN Proxy, Netscape Proxy, Gauntlet

Data Elements 

The key aspect of REST is the state of the data elements, its components communicate by transferring representations of the current or desired state of data elements.  

REST identifies six data elements: a resource, resource identifier, resource metadata, representation, representation metadata, and control data, shown in the table below:
Data ElementDescriptionExample
Resource    Any information that can be named is a resource. A resource is a conceptual mapping to a set of entities, not the entity itself.Title of a movie from IMDb, A Flash movie from YouTube, Images from Flickr etc
Resource Identifier         Every resource must have a name that uniquely identifies it. Under HTTP these are called URIs. Uniform Resource Identifier (URI) in a RESTful system is a hyperlink to a resource. It is the only means for clients and servers to exchange representations of resources. The relationship between URIs and resources is many to one. A resource can have multiple URIs which provide different information about the location of a resource.
Resource metadata            This describes the resource. A metadata provides additional information such as location information, alternate resource identifiers for different formats or entity tag information about the resource itself.Source link, vary
Representation  It is something that is sent back and forth between clients and servers. So, we never send or receive resources, only their representations. A representation captures the current or intended state of a resource. A particular resource may have multiple representationsSequence of bytes, HTML document, archive document, image document
Representation metadataThis describes the representation.Headers (media-type)
Control dataThis defines the purpose of a message between components, such as the action being requested.If-Modified-Since, If-Match
Addressable means anything that can be accessed and transferred between clients and servers
Details of the standardized format of a URI are as follows:
scheme://host: port/path?queryString#fragment
  • scheme - It is the protocol you are using to communicate with. For RESTful web services, it is usually HTTP or HTTPS
  • host - It is a DNS name or IP address
  • port - This is optional and which is numeric The host and port represent the location of your resource on the network
  • path - This expression is a set of text segments delimited by the “/” character. Think of the path expression is a directory list of a file on your machine
  • ? - This character separates the path from the queryString. queryString -This is a list of parameters represented as name/value pairs. Each pair is delimited with the “&” character. Here’s an example query string within a URI:
  • fragment: It is delimited by a “#” character. The fragment is usually used to point to a certain place in the document you are querying