SmartCampus
2 october 2014 – Version 1.0
Written by: Cyril Cecchinel / I3S-Modalis
User data API
Technical documentation
Queries respect the HTTP 1.1 standard. A GET request only read and returns resources. A POST request may cause the creation of a new resource and is not idempotent. A PUT request is idempotent and refers directly to a resource that will be created if it doesn’t exists, or updated otherwise. A DELETE request delete a resource.
Parameters specified in this documentations refers to data that can or must be transmitted to the server. Depending on the type of request, the parameters are given in a different way:
The API returns standard HTTP codes, and in particular:
200 | Request processed successfully. Indicates that recovery, modification or deletion of a resource was successful. |
201 | Resource created successfully. Indicates that the operation of adding the resource was successful (after a PUT or POST for example). |
400 | Incorrect parameters. Indicates that the request parameters are incorrect (e.g. required parameter unspecified). |
404 | Resource not found. Indicates that one wants to access a resource that does not exist (e.g with the wrong ID). |
A sensor can be a real sensor (physical device plugged into a sensor platform) or virtual (virtual aggregation of several sensors providing data).
Object : SENSOR
{ "name" : (String) Sensor name (unique), "kind" : (String) Kind of sensor (light, temp …), "sensorType" : (String) Sensor type, either physical or virtual, "frequency" : (Integer) Mesure period (in second), "endpoint" : { "ip" : (String) Endpoint IP/URL, "port" : (Integer) Endpoint port } // Bellow: Physical sensors only "pin" : (Integer) Pin number on the sensor platform, "board" : (String) Sensor platform ID, // Bellow: Virtual sensors only "script" : (Groovy script) Transformation rule } |
DESCRIPTION | Get the list of registered sensors |
RESULTS | JSON table of sensor objects Example: http://smartcampus.unice.fr/data-api/sensors |
DESCRIPTION | Get the last data for a given sensor | ||
URL STRUCTURE | name Sensor name | ||
PARAMETERS | convert (Boolean) If set to true, the date will be converted in a “human-readable” date | ||
RESULT | JSON object containing the last sensor data id Sensor name. values Table of data : date Date of measurement (YYYY-MM-DD hh:mm:ss). value Measure at that date EXAMPLE
EXAMPLE with convert = true
| ||