Sunday, November 28, 2010

REST based Requests

REST here means 'Representational State Transfer' and is a software architecture style for distributed hypermedia systems such as the World Wide Web. Since this definition is a bit hard to grasp, a more simpler definiton would be to say that  REST is a set of principles that define how Web standards, such as HTTP and URIs, are supposed to be used.


Th advantage of adhering to REST principles when designing an application lies in the fact that the new system will be able to exploit the Web’s architecture in a better way.


There are 5 key principles to keep in mind to keep compliance with the REST standards. They are,

  • Give every “thing” an ID - Simply, use URIs to identify everything that needs to be identified (high level resources-individual items, collections of items, virtual and physical objects, or computation results)
  • Link things together -Use links to refer to identifiable things (resources) wherever possible 
  • Use standard methods - What this means is that, for clients to be able to interact with server resources, these server resources should implement the default application protocol (HTTP) correctly (E.g.:- make use of the standard methods GET, PUT, POST, DELETE)
  • Resources with multiple representations One way to exploit this principle is to turn the application’s Web UI into its Web API. Such a method is a brilliant way to get a better Web interface for both humans and other applications.
  • Communicate statelessly - This means that a server should not have to retain some sort of communication state for any of the clients it communicates with beyond a single request.

No comments:

Post a Comment