Search This Blog

Saturday 10 December 2016

What Are RESTful Web Services

Representational State Transfer (REST) is an architectural style that specifies constraints, such as the uniform interface, that if applied to a web service induce desirable properties, such as performance, scalability and modifiability that enable services to work best on the Web.
In the REST architectural style, data and functionality are considered resources and are accessed using Uniform Resource Identifiers (URIs), typically links on the Web.
It revolves around resource where every component is a resource and a resource is accessed by a common interface using HTTP standard methods. In the REST architecture style, clients and servers exchange representations of resources by using a standardized interface and protocol.
In REST architecture, a REST Server simply provides access to resources and REST client accesses and presents the resources. Each resource is identified by URIs/ global IDs. REST uses various representations to represent a resource like text, JSON and XML.  JSON is the most popular format being used in web services.
The following principles encourage RESTful applications to be simple, lightweight, and fast:
·         Resource identification through URI: A RESTful web service exposes a set of resources that identify the targets of the interaction with its clients. Resources are identified by URIs, which provide a global addressing space for resource and service discovery.
·         Uniform interface: Resources are manipulated using a fixed set of four create, read, update, delete operations: PUT, GET, POST, and DELETE. PUT creates a new resource, DELETE is used to remove a resource. GET retrieves the current state of a resource. POST is used to update an existing resource.
·         Self-descriptive messages: Resources are decoupled from their representation so that their content can be accessed in a variety of formats, such as HTML, XML, plain text, PDF, JPEG, JSON, and others.

·         Stateful interactions: Every interaction with a resource is stateless. It is responsibility of the client to pass its context to server and then server can store this context to process client's further request.  Stateful interactions are based on the concept of explicit state transfer. Several techniques exist to exchange state, such as URI rewriting, cookies, and hidden form fields. State can be embedded in response messages to point to valid future states of the interaction. 

1 comment:

  1. Last time I checked it was like, PUT is used for update whileas POST is used for create.

    ReplyDelete