Version 7 (modified by 13 years ago) (diff) | ,
---|
RESTful interface
The components of the monitoring framework use a restful web interface to exchange data. This section is a full documentation of the interface as well as codes examples, showcasing how the interface can be used and extended.
Concept
Restful web service is a light weight remote procedure call (rpc) interface, using a client-server architecture. The server provides a number of methods that can be called by the client. Therefor client and server are connected via TCP using HTTP as message protocol. Methods are identified by an URI in the HTTP header. The payload of a message, the returned value of a method, is encoded in XML.
A detailed description of RESTful web service can be found at :
http://en.wikipedia.org/wiki/Representational_state_transfer
http://www.ibm.com/developerworks/webservices/library/ws-restful/
Example call
To call a method on the Rest server a HTTP POST message has to be send to the server. This POST message has to contain the URL (name of the method) and a number of arguments, if necessary for the call.
For example, if we want to call the method hello_client(int i) we use the name of the call as the URL for the HTTP header. The method also takes one argument, in the payload of the HTTP POST we append this argument using a prefix that indicates the order of the arguments.
POST /hello_client HTTP/ 1 . 1 User Agent: HAMcast Monitoring Content Length: 32 Content Type: Content Type: text/plain; charset=utf 8 arg0=5;