REST
REST is an architectural style that stands for Representational State Transfer. Reading Material for REST can be found in several places including:
- Build a RESTful Web service using Jersey and Apache Tomcat
- 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.
- GET is used to retrieve information about single piece of data or a list of data.
- POST is used to create new objects.
- PUT is used to update objects
- DELETE is used to delete objects represented in the URI.
Examples of a URI are:
- http://server.com/applicationdomain/networkelement => represents all network elements
- http://server.com/applicationdomain/networkelement/200 => represents NE#200
- http://server.com/applicationdomain/networkelement/200/port/15256 => represents a port on a NE.
- 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.