January 2018
SIOT Documentation
Version v2.5
SIOT.net and SIOTCenters
SIOT.net
SIOT.net is service where user (customer) can order, purchase and create his own SIOT Centre.
Process:
- Enter basic personal data and email address
- SIOT.net will send confirmation mail with user SIOT Centre URL and license
- To finish SIOT Centre startup user need to enter license, voucher credential data (username and password)
- SIOT.net will create and run unique instance of SIOT Center
SIOT Center
SIOT Centre exists as independent application, and each center is subscribed to specific topics on MQTT Broker.
Example:
SIOT Centre with license 1DAE-0281-F785-4BC4-A033-C3F7-8B9F-5B01will be subscribe on topics
siot/MNF/1DAE-0281-F785-4BC4-A033-C3F7-8B9F-5B01/#
siot/CNF/1DAE-0281-F785-4BC4-A033-C3F7-8B9F-5B01/#
siot/DAT/LICENCE/SENSOR or ACTOR_GUID and
SIOT Centre will store all manifests, configurations and data and serve it to other applications over Web application program interface (Web API)
SIOT API
Get MQTT and SIOT Centre URL
Request:
- Request method: POST or GET
- Request URL: http(s)://url.siot.net/
- Request parameters:
- licence (example: 1DAE-0281-F785-4BC4-A033-C3F7-8B9F-5B01or 1DAE0281F7854BC4A033C3F78B9F5B01)
Valid response:
{"mqtt":{"urls":["india313.startdedicated.de"]},"error_code":0,"versionAPI":1}
Invalid responses:
{"error":"Incorrect licence","error_code":1}
{"error":"Too many attempts","error_code":2}
{"error":"Licence Expire","error_code":3}
{"error":"Licence Banned","error_code":4}
Get Manifest
Request:
- Request method: POST
- Request URL: http(s)://SIOT_CENTRE_URL/getmanifest
- Request parameters:
- sensorUID (example: 06fb7fda-de7a-4ec3-b8cc-d32a601046ac)
Response:
Manifest in json format
Get Configuration
Request:
- Request method: POST
- Request URL: http(s)://SIOT_CENTRE_URL/getconfig
- Request parameters:
- sensorUID (example: 06fb7fda-de7a-4ec3-b8cc-d32a601046ac)
Response:
Configuration in json format
Get Input Data
Get Last Data
Request:
- Request method: POST
- Request URL: http(s)://SIOT_CENTRE_URL/getdata
- Request parameters:
- centerUID (example: 53b40972-fe64-4408-aa32-e6ad0c1d2f40)
- sensorUID (example: 06fb7fda-de7a-4ec3-b8cc-d32a601046ac)
Response:
Input value in any format (int, string, bool, json, binary…)
Get Last N Data
Request:
- Request method: POST or GET
- Request URL: http(s)://SIOT_CENTRE_URL/getdatalastn
- Request parameters:
- centerUID (example: 53b40972-fe64-4408-aa32-e6ad0c1d2f40)
- sensorUID (example: 06fb7fda-de7a-4ec3-b8cc-d32a601046ac)
- count – integer (example 2)
Response:
[{"data":["43.317851999999995","21.920624"],"time":1448620452273},{"data":["43.317838699999996","21.9205865"],"time":1448617989400}]
Get Data From
Request:
- Request method: POST or GET
- Request URL: http(s)://SIOT_CENTRE_URL/getdatafrom
- Request parameters:
- centerUID (example: 53b40972-fe64-4408-aa32-e6ad0c1d2f40)
- sensorUID (example: 06fb7fda-de7a-4ec3-b8cc-d32a601046ac)
- from – integer – Time Stamp (example: 1448532864712)
Response:
[{"data":["43.3188862","21.8958238"],"time":1448532876729},{"data":["43.3188862","21.8958238"],"time":1448532884455},{"data":["43.3188769","21.8958215"],"time":1448532891460},{"data":["43.318893599999996","21.895831700000002"],"time":1448532904450}]
Get Data Between
Request:
- Request method: POST or GET
- Request URL: http(s)://SIOT_CENTRE_URL/getdatabetween
- Request parameters:
- centerUID (example: 53b40972-fe64-4408-aa32-e6ad0c1d2f40)
- sensorUID (example: 06fb7fda-de7a-4ec3-b8cc-d32a601046ac)
- from – integer – Time Stamp (example: 1448532864712)
- to – integer – Time Stamp (example: 1448532904450)
Response:
[{"data":["43.3188862","21.8958238"],"time":1448532876729},{"data":["43.3188862","21.8958238"],"time":1448532884455},{"data":["43.3188769","21.8958215"],"time":1448532891460},{"data":["43.318893599999996","21.895831700000002"],"time":1448532904450}]
Get Inputs & Outputs List
Request:
- Request method: POST or GET
- Request URL: http(s)://SIOT_CENTRE_URL/getlist
- Legacy alias: http(s)://SIOT_CENTRE_URL/getsensor
- Request parameters:
- centerUID (example: 53b40972-fe64-4408-aa32-e6ad0c1d2f40)
Response:
[{name": "Temperature input","guid": "c3567e21-ebf4-43dc-879a-c4729bbcec89"}….]
Get Inputs List
Request:
- Request method: POST or GET
- Request URL: http(s)://SIOT_CENTRE_URL/getinput
- Request parameters:
- centerUID (example: 53b40972-fe64-4408-aa32-e6ad0c1d2f40)
Response:
[{name": "Temperature input","guid": "c3567e21-ebf4-43dc-879a-c4729bbcec89"}….]
Get Outputs List
Request:
- Request method: POST or GET
- Request URL: http(s)://SIOT_CENTRE_URL/getoutput
- Request parameters:
- centerUID (example: 53b40972-fe64-4408-aa32-e6ad0c1d2f40)
Response:
[{name": "Temperature input","guid": "c3567e21-ebf4-43dc-879a-c4729bbcec89"}….]
SIOT Centre Update
Any instance of SIOT Centre content links to SIOT blue print files, so process of updating is that developer need to change SIOT blue print files and to restart all instances of SIOT Centres. Configuration files and databases are separated for every SIOT Centre.
SIOT MQTT Topics
Manifest
Topic: siot/MNF/centerGUID/inputGUID or outputGUID/
Format: JSON
Structure:
{
"name":"Geoposition Input",
"type":"sensor",- sensor or actor
"zone":{
"name":"Zone name",
"guid":"2c0c171a-a828-4f90-be15-7b1f95c8deb8"
}
"description":"Geoposition Input",
"valueType":"json",- or int, float, string, text, bool, file, binary, timestamp…
"jsonMapping":{- if valueType is json
"longitude":"float",- key and type
"latitude":"float",
"direction":"float"
},
"file":{- if valueType is fiile
"name":"fileName.png",
"type":"image"- image, mp3, text, wav
"size":42563,- bytes
"date":1450774319932- timestamp
}
}
Configuration
Topic: siot/CNF/centerGUID/inputGUID or outputGUID
Format: JSON
Output
Structure:
{
"inputGUID": "GUID"
}
Input
Structure:
{
"storage":"db",
}
Data
Topic: siot/DAT/centerGUID/ inputGUID or outputGUID
Command
Topic: siot/CMD/centerGUID/ inputGUID or outputGUID
Status
Topic: siot/STA/centerGUID/ inputGUID or outputGUID
SIOT MQTT Trough REST
Set Data (Method One)
URL: SIOT_CENTRE_URL/set/INPUT_GUID?value=VALUE
Response:
{"topic":"siot/DAT/LICENCE/INPUT_GUID","message":"77"}
Set Data (Method Two)
URL: SIOT_CENTRE_URL/ /mqtt/request? topic=TOPIC&message=MESSAGE
Response:
{"topic":"TOPIC","message":"MESSAGE"}
Get Data
URL: SIOT_CENTRE_URL/get/INPUT_GUID
Response:
{“data”:INPUT_VALUE}
SIOT MQTT Subscribe
Trough Web Socket
JavaScript Code
// CENTER WS PORT = CENTER PORT + 1
ws = new WebSocket("wss://CENTER_URL:CENTER_WS_PORT");
ws.onopen = function (event) {
ws.send(JSON.stringify({uuid:"LICENCE", guid: "GUID"}));
};
ws.onmessage = function (event) {
var data = JSON.parse(event.data);
console.log(data);
}
1