Tuesday, February 14, 2012

REST - an architectural style

Here in this post, I would like to keep some short notes on REST be written down.

REST is an architectural style to build networked applications. 
World wide web is based on REST style has following key characteristics:

1. Resources identified through URL:

URLs are defined to access every resource, which provides a consistent way of naming things in the web. This leads to build up a global addressing space for resource discovery.

Eg: A thing will have a url as : 

A collection of things will have a url as:

2. Uniform interface for resources:

Every resource is exposed through a uniform interface consisting of a universal set of verbs - GET, POST, PUT, DELETE. All the operations to manipulate the resource should be aligned with this interface.

This enables any component that understands a RESTful protocol (i.e HTTP), to communicate with the application and also avoids the need of having WSDL like service descriptions.

3. Multiple representations for resources:

Resource is a concept. It can have multiple representations - represented in multiple formats for different needs. These representations can vary from HTML like web pages to XML to JSON to many more.

4. Stateless Communication:

RESTful  server application doen't retain state - it is either turned into resource state or maintained in client.

This characteristic provides several advantages such as:
       - avoids server being coupled to specific client
       - load balancing becomes easier
       - more reliable to network failures
       - minimizes server footprint

- REST is first defined in PhD thesis of Roy Fielding http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm
- http://www.infoq.com/articles/rest-introduction
- http://docs.oracle.com/javaee/6/tutorial/doc/gijqy.html

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.