REST

REST is an architectural style that stands for Representational State Transfer.  Reading Material for REST can be found in several places including:

  1. Build a RESTful Web service using Jersey and Apache Tomcat
  2. A Beginner’s Guide to HTTP and REST | Nettuts+

 

HTTP itself is a good example of REST, where all data are defined by specific URI. URI itself has structure and the data is manipulated using HTTP Primitives.

  1. GET is used to retrieve information about single piece of data or a list of data.
  2. POST is used to create new objects.
  3. PUT is used to update objects
  4. DELETE is used to delete objects represented in the URI.

 

Examples of a URI are:

  1. http://server.com/applicationdomain/networkelement => represents all network elements
  2. http://server.com/applicationdomain/networkelement/200 => represents NE#200
  3. http://server.com/applicationdomain/networkelement/200/port/15256 => represents a port on a NE.
  4. http://server.com/applicationdomain/trail/50/port/15256 => The same port but viewed as a part of a connection.  This is a key point, a resource (here port=15256) can be accessed either via networkelement or a trail. So the URI with REST is a way to access and represent an object and not a unique identifier of the object in question.

 

Typically, REST URIs do not use verbs but nouns. This includes action. For example to so switchProtection, on a connection, one should think of the object that's being manipulated is a switchStatus and then act on that. example: http://server.com/applicationdomain/connection/50/port/15256/switchstatus will create a switch with targetState=FSW in the POST DATA.