Pages

Friday, May 25, 2007

REST Architecture

Buffer

What is REST & what I understand by it??

Here is how Dr. Roy Fielding defines it:

Representational State Transfer is intended to evoke an image of how a well-designed Web application behaves: a network of web pages (a virtual state-machine), where the user progresses through an application by selecting links (state transitions), resulting in the next page (representing the next state of the application) being transferred to the user and rendered for their use.”

The term was first given to describe a form of web architecture. So in short, REST is a model for building a distributed system.

Webservices & REST

Early webservices were the same as well. It was signified by the lack of integration among the services & difficulties in embedding services from various other sources.

This is where the role of REST comes into picture. REST, in fact is only a architecture. It doesn't bog you down with what underlying technologies to use, but helps you build distributed web applications & services. This way, RESTful webservice came to be known as second generation webservices.

Designing a RESTful webservice involves:

  1. Become free of underlying programming semantics. Expose the business implementation as a service. So the consumer will identify the service with a URI, which becomes a representation.
  2. This enables the representation to be callable over the HTTP interface.
  3. Each representation should have URL links to other representations.
  4. The URIs should not show any actions, should be shown like a verb/noun.

Eg. http://www.abc.com/AddItem

And not like,

http://www.abc.com/showPage?Process=Add

  1. XML is the format to work on, so design proper schema for representations.