管理接口
站点:
curl-X GET http://47.95.254.34:5122/iot/api/sites
curl-X GEThttp://47.95.254.34:5122/iot/api/sites/7b0db932-43c2-11e8-a7b2-705ab6ad9cae
curl-X POST http://47.95.254.34:5122/iot/api/sites -d'{"token":"","name":"test","description":"testsite","metadata" : { } }'
curl-X DELEThttp://47.95.254.34:5122/iot/api/sites/9f55bdc8-430c-11e8-a46b-00231487c7b4
curl-X PUT http://47.95.254.34:5122/iot/api/sites -d'{"token":"7b0db932-43c2-11e8-a7b2-705ab6ad9cae","name":"test","description":"testsite","metadata" : {"type":"test"}}'
租户:
curl-X GET http://47.95.254.34:5122/iot/api/tenants
curl-X GET http://47.95.254.34:5122/iot/api/tenants/test1
curl-X POST http://47.95.254.34:5122/iot/api/tenants -d'{"id":"test","name":"testtenant","authenticationToken":"","authorizedUserIds":["admin"],"metadata": {}}'
curl-X DELET http://47.95.254.34:5122/iot/api/tenants
curl-X PUT http://47.95.254.34:5122/iot/api/tenants -d'{"id":"test","name":"testtenant","authenticationToken":"123","authorizedUserIds":["admin"],"metadata": {}}'
用户:
curl-X GET http://47.95.254.34:5122/iot/api/users
curl-X GET http://47.95.254.34:5122/iot/api/users/atm
curl-X POST http://47.95.254.34:5122/iot/api/users -d'{"username":"atm","hashedPassword":"123456","metadata":{}}'
curl-X DELET http://47.95.254.34:5122/iot/api/users/atm006
curl-X PUT http://47.95.254.34:5122/iot/api/users -d'{"username":"atm","hashedPassword":"1234561","metadata":{}}'
设备:
curl-X GET http://47.95.254.34:5122/iot/api/devices
curl-X GET http://47.95.254.34:5122/iot/api/devices/test1234560
#按照sitetoken查询type=all查询所有
curl -X GET http://127.0.0.1:5000/iot/spi/devices?type=0001
curl-X POST http://47.95.254.34:5122/iot/api/devices -d'{"hardwareId":"test123456","siteToken":"","comments":"","metadata":{}}'
curl-X DELET http://47.95.254.34:5122/iot/api/devices/test1234560
curl-X PUT http://47.95.254.34:5122/iot/api/devices -d'{"hardwareId":"test123456","siteToken":"1234","comments":"","metadata":{}}'
数据接口
修改#
curl -X GET http://127.0.0.1:5120/iot/spi/devices/test1234560z/events/DevicesData
curl -X GET http://127.0.0.1:5120/iot/spi/devices/test1234560z/events/UserCommands
curl -X POST http://127.0.0.1:5120/iot/spi/devices/test1234560z/events/UserCommands
-d '{"eventType":"test","siteToken":"testtoken","hardwareId":"test1234560z","metadata":{},"eventbody":{},"ext":{"test":"test"}}'
MQTT接口
接入Topic:/iot/input/json
json消息:
{"eventType":"DevicesData","siteToken":"testtoken","eventDate":"xx","receivedDate":"xx","hardwareId":"test1234560z","metadata":{"xyx":"zzz"},"eventbody":[]}
订阅Topic:
1、/iot/output/json
2、/iot/output/json/<sitetoken> #待续