REST is an architectural style which is based on web-standards and the HTTP protocol. The REST architectural style was initially described by Roy Fielding in the year 2000 in his thesis. Roy Fielding was also One of the principal authors of the HTTP specification. REST stands for REpresentational State Transfer.
As described the REST is architectural style of the web, but what does that even mean??
REST is a set of design criteria and not the physical structure or architecture of the system. REST is not tied to the ‘Web’ i.e. doesn’t depend on the mechanics of HTTP ‘Web’ applications are the most prevalent. hence RESTful architectures run off of it.
Representational State Transfer refers to transferring “representations”. You are using a “representation” of a resource to transfer resource state which lives on the server into application state on the client.
In a REST based architecture everything is a resource. Rest Resource is data on which we want to perform operation(s). So this data can be present in database as record(s) of table(s) or in any other form.This record has unique identifier with which it can be identified like id for Employee. A resource is accessed via a common interface based on the HTTP standard methods.
In a REST based architecture you have a REST server which provides access to the resources. A REST client can access and modify the REST resources. Every resource should support the HTTP common operations. Resources are identified by global IDs (which are typically URIs). URI is an ‘address’ of a resource. A resource must have at least one URI. No URI is Not a resource (i.e. it’s really not on the web, so to speak ). URIs should be descriptive (human parseable) and have structure. For Example:
http://www.example.com/eclipse/releases/version.tar.gz
http://www.example.com/temperature/USA/CA
http://www.example.com/search/employee_id
http://www.example.com/data/2017
REST allows that resources have different representations, e.g., text, XML, JSON etc. The REST client can ask for a specific representation via the HTTP protocol (content negotiation).
- GET: Retrieve representation of resource
- PUT: Update/modify existing resource (or create a new resource)
- POST: Create a new resource
- DELETE: Delete an existing resource
there are 2 less commonly used methods:
- HEAD: Fetch meta-data of representation only (i.e. a metadata representation)
- OPTIONS: Check which HTTP methods a particular resource supports
API means Application Programming Interface In computer programming, API is a set of subroutine definitions, protocols, and tools for building application software.
Resources:
RESTful (Web) Applications In Practice by Nupul Kukreja
Leave a Reply