RESTful API
General
Application use the services of the M2MLabs Mainspring server via standard RESTful web service API's. The WADL RESTful webservice description on a local running server is located under http://localhost/cs-ws/resources/application.wadl
- for simple GET methods any internet browser or curl
- for POST, PUT, DELETE methods curl or SoapUI
- the graphical admin console of Mainspring located on a local running server at http://localhost/cs-ws
The easiest way to get curl on Windows is to install cygwin.
SoapUI can be downloaded from https://sourceforge.net/projects/soapui/files
Reference
Modelling Services
- Owners model entities that own devices, device models, sensor models, actor models and scripts. Entities belonging to an owner are invisible to other owners except the admin owner.
- Sensor Models model parts of a device model that send data. Each sensor model contains 1..n attributes and their datatype. When a device is sending data it is actually sending timestamped values of attributes defined in the sensor model. A sensor model may be used in one or more device models
- Actor Models model parts of a device model that execute commands. Each actor model contains 1..n attributes and their datatype. When a device is sending commands it is actually sending values of attributes defined in the actor model. An actor model may be used in one or more device models
- Device Models represent a device type of a real device. Individual devices are then created based on the device model. Device models contain sensors and actors
- Devices represent individual real world devices. They are created either by an administration application or by device self creation
- Device Groups represent groups of devices. They are created either by an administration application or by device self creation
- Event Models model events sent by a device. Events contain a timestamp, a fixed searchable set of attributes and raw data as String. Raw data can be in any textual format e.g. JSON.
Connector Services
These services are used by devices to send data and synchronize time
Retrieval Services
These services are used by applications to retrieve stored device data
Command Services
These services are used by by applications to create and maintain commands and by devices to poll for commands
Script Services
These services are used by by applications to add application specific logic via hooks. Currently there are two hooks defined to execute Groovy, Javascript or Blockly scripts whenever new sensor data is received by the server and to connect devices that use arbitrary HTTP requests to send sensor data instead of the standard HTTP POST web service.