api is found at http://hostname:port/api
add a sensor and optional metadata to the database
- Content-Type: "application/json"
{
"name":"a human friendly sensor name",
"description":"a short description of the sensor"
}
response:
- Status: 200
- Data.id: /^[a-f\d]{24}$/ // The nodes unique {sensor_id}.
update an existing sensors metadata
- Content-Type: "application/json"
{
"name":"a DIFFERENT human friendly sensor name",
"description":"a DIFFERENT short description of the sensor"
}
response:
- Status: 200
get an existing sensors metadata
- Content-Type: "application/json"
response:
- Status: 200
{
"name":"a DIFFERENT human friendly sensor name",
"description":"a DIFFERENT short description of the sensor"
}
send sensor data to the server
- Content-Type: "application/json"
{
"value":12,
"collection_time":"2016-12-02T08:36:55.743Z"
}
response:
- Status: 200
obtain the latest sample from a given sensor
- Content-Type: "application/json"
response:
- Status: 200
{
"value":12,
"collection_time":"2016-12-02T08:36:55.743Z"
}
obtain all data for a given sensor
- Content-Type: "application/json"
response:
- Status: 200
[
{
"value":12,
"collection_time":"2016-12-02T08:36:55.743Z"
}
]
add an actor to the database
- Content-Type: "application/json"
{
"name":"lamp",
"description":"turns the lamp on/off",
"state_type":"boolean"
}
response:
- Status: 200
- Data.id: /^[a-f\d]{24}$/ // The nodes unique {actor_id}.
get the details of a specific actor
- Content-Type: "application/json"
response:
- Status: 200
{
"name":"lamp",
"description":"turns the lamp on/off",
"state_type":"boolean"
}
update an actor entry in the database
- Content-Type: "application/json"
{
"description":"controls the brightness of a lamp",
"state_type":"number"
}
response:
- Status: 200
add a new behaviour
- Content-Type: "application/json"
{
"enabled": true,
"description":"a behaviour for testing",
"sensor":"{sensor_id}",
"actor":"{actor_id}",
"action": 123,
"condition": "equal",
"value": 10
}
response:
- Status: 200
send sensor data to the , this time to trigger a behaviour
- Content-Type: "application/json"
{
"value":10,
"collection_time":"2016-12-03T08:36:55.743Z"
}
response:
- Status: 200