RESTful API and MQTT Topics
URL Specification
Every URL relates to a specific resource or list of resources.
RESTful API: http://<ip address>:port/restapi/<resource path>
Default Port: 3000
Default User Name: admin
Default Password: admin
MQTT Topic: <resource path>
MQTT response is not include ‘{"result": }’
Linear Dust WSN Resources
Description |
Retrieve the WSN manager setting information.
|
URI Resource Path |
/WSNMgmt/IoTGW/WSN/<mac addr>/Setting
|
MQTT Topic Format |
/WSNMgmt/IoTGW/WSN/<mac addr>/Setting
|
Method(HTTP/MQTT) |
GET/SUB
|
Request JSON Data |
N/A
|
Response JSON Data |
{
"result":{
"e":[
{
"n":"NetID",
"sv":"2001",
"asm":"rw"
},
{
"n":"JoinKey",
"sv":"JOINADVANTECHIOT",
"asm":"rw"
},
{
"n":"Interface",
"v":1,
"asm":"r"
}
]
}
}
|
Example |
curl -H "Content-Type: application/json" -X GET http://username:password@<IP:Port>/restapi/WSNMgmt/IoTGW/WSN/<mac addr>/Setting
|
Example |
mosquito_sub -h <IP> -C 1 -t /WSNMgmt/IoTGW/WSN/<mac addr>/Setting
|
Description |
Set a new Network ID for the WSN manager.
|
URI Resource Path |
/WSNMgmt/IoTGW/WSN/<mac addr>/Setting/NetID
|
MQTT Topic Format |
/WSNMgmt/IoTGW/WSN/<mac addr>/Setting/NetID
|
Method(HTTP/MQTT) |
POST/PUB
|
Request JSON Data |
{
"sv":"1234"
}
|
Response JSON Data |
{
"result":"true"
}
|
Example |
curl -H "Content-Type: application/json" -X POST -d '{"sv":"1234"}' http://username:password@<IP:Port>/restapi/WSNMgmt/IoTGW/WSN/<mac addr>/Setting/NetID
|
Example |
mosquitto_pub -h <IP> -m '{"sv":"1234"}' -t /WSNMgmt/IoTGW/WSN/<mac addr>/Setting/NetID
|
Description |
Set a new Join Key for the WSN manager.
|
URI Resource Path |
/WSNMgmt/IoTGW/WSN/<mac addr>/Setting/JoinKey
|
MQTT Topic Format |
/WSNMgmt/IoTGW/WSN/<mac addr>/Setting/JoinKey
|
Method(HTTP/MQTT) |
POST/PUB
|
Request JSON Data |
{
"sv":"DUSTNETWORKSROCK"
}
|
Response JSON Data |
{
"result":"true"
}
|
Example |
curl -H "Content-Type: application/json" -X POST -d '{"sv":"DUSTNETWORKSROCK"}' http://username:password@<IP:Port>/restapi/WSNMgmt/IoTGW/WSN/<mac addr>/Setting/JoinKey
|
Example |
mosquitto_pub -h <IP> -m '{"sv":"DUSTNETWORKSROCK"}' -t /WSNMgmt/IoTGW/WSN/<mac addr>/Setting/JoinKey
|
Description |
Retrieve the WSN manager information.
|
URI Resource Path |
/WSNMgmt/IoTGW/WSN/<mac addr>/Info
|
MQTT Topic Format |
/WSNMgmt/IoTGW/WSN/<mac addr>/Info
|
Method(HTTP/MQTT) |
GET/SUB
|
Request JSON Data |
N/A
|
Response JSON Data |
{
"result":{
"e":[
{
"n":"SenHubList",
"sv":"00170d0000582cca,00170d0000306265",
"asm":"r"
},
{
"n":"Neighbor",
"sv":"00170d0000306265",
"asm":"r"
},
{
"n":"Health",
"v":100,
"asm":"r"
},
{
"n":"Name",
"sv":"WSN0",
"asm":"r"
},
{
"n":"sw",
"sv":"1.2.1.12",
"asm":"r"
},
{
"n":"reset",
"bv":0,
"asm":"rw"
}
]
}
}
|
Example |
curl -H "Content-Type: application/json" -X GET http://username:password@<IP:Port>/restapi/WSNMgmt/IoTGW/WSN/<mac addr>/Info
|
Example |
mosquito_sub -h <IP> -C 1 -t /WSNMgmt/IoTGW/WSN/<mac addr>/Info
|
Description |
Reset the WSN manager.
|
URI Resource Path |
/WSNMgmt/IoTGW/WSN/<mac addr>/Info/reset
|
MQTT Topic Format |
/WSNMgmt/IoTGW/WSN/<mac addr>/Info/reset
|
Method(HTTP/MQTT) |
POST/PUB
|
Request JSON Data |
{
"bv":1
}
|
Response JSON Data |
{
"result":"true"
}
|
Example |
curl -H "Content-Type: application/json" -X POST -d '{"bv":1}' http://username:password@<IP:Port>/restapi/WSNMgmt/IoTGW/WSN/<mac addr>/Info/reset
|
Example |
mosquitto_pub -h <IP> -m '{"bv":1}' -t /WSNMgmt/IoTGW/WSN/<mac addr>/Info/reset
|
Description |
Retrieve the WSN Network Statistics.
|
URI Resource Path |
/WSNMgmt/IoTGW/WSN/<mac addr>/NetworkStatistics
|
MQTT Topic Format |
/WSNMgmt/IoTGW/WSN/<mac addr>/NetworkStatistics
|
Method(HTTP/MQTT) |
GET/SUB
|
Request JSON Data |
N/A
|
Response JSON Data |
{
"result":{
"netstat":{
"NetReliability":100,
"NetPathStability":97,
"msNetLatency":400
},
"senhub":{
"e":[
{
"mac":"00170d0000582cca",
"id":1,
"stat":"OPER",
"routing":"YES",
"reliablity":100,
"mslatency":0
},
{
"mac":"00170d0000306265",
"id":2,
"stat":"OPER",
"routing":"YES",
"reliablity":100,
"mslatency":700
}
]
}
}
}
|
Example |
curl -H "Content-Type: application/json" -X GET http://username:password@<IP:Port>/restapi/WSNMgmt/IoTGW/WSN/<mac addr>/NetworkStatistics
|
Example |
mosquito_sub -h <IP> -C 1 -t /WSNMgmt/IoTGW/WSN/<mac addr>/NetworkStatistics
|
Description |
Retrieve the Sensor Hub information.
|
URI Resource Path |
/WSNMgmt/<mac addr>/SenHub/Info
|
MQTT Topic Format |
/WSNMgmt/<mac addr>/SenHub/Info
|
Method(HTTP/MQTT) |
GET/SUB
|
Request JSON Data |
N/A
|
Response JSON Data |
{
"result":{
"e":[
{
"n":"Name",
"sv":"Motion",
"asm":"rw"
},
{
"n":"sw",
"sv":"1.0.00",
"asm":"r"
},
{
"n":"reset",
"bv":1,
"asm":"rw"
}
]
}
}
|
Example |
curl -H "Content-Type: application/json" -X GET http://username:password@<IP:Port>/restapi/WSNMgmt/<mac addr>/SenHub/Info
|
Example |
mosquito_sub -h <IP> -C 1 -t /WSNMgmt/<mac addr>/SenHub/Info
|
Description |
Set the Sensor Hub name.
|
URI Resource Path |
/WSNMgmt/<mac addr>/SenHub/Info/Name
|
MQTT Topic Format |
/WSNMgmt/<mac addr>/SenHub/Info/Name
|
Method(HTTP/MQTT) |
POST/PUB
|
Request JSON Data |
{
"sv":"Motion123"
}
|
Response JSON Data |
{
"result":"true"
}
|
Example |
curl -H "Content-Type: application/json" -X POST -d '{"sv":"Motion123"}' http://username:password@<IP:Port>/restapi/WSNMgmt/<mac addr>/SenHub/Info/Name
|
Example |
mosquitto_pub -h <IP> -m '{"sv":"Motion123"}' -t /WSNMgmt/<mac addr>/SenHub/Info/Name
|
Description |
Reset the Sensor Hub.
|
URI Resource Path |
/WSNMgmt/<mac addr>/SenHub/Info/reset
|
MQTT Topic Format |
/WSNMgmt/<mac addr>/SenHub/Info/reset
|
Method(HTTP/MQTT) |
POST/PUB
|
Request JSON Data |
{
"bv":1
}
|
Response JSON Data |
{
"result":"true"
}
|
Example |
curl -H "Content-Type: application/json" -X POST -d '{"bv":1}' http://username:password@<IP:Port>/restapi/WSNMgmt/<mac addr>/SenHub/Info/reset
|
Example |
mosquitto_pub -h <IP> -m '{"bv":1}' -t /WSNMgmt/<mac addr>/SenHub/Info/reset
|
Description |
Retrieve the Sensor Hub available action.
|
URI Resource Path |
/WSNMgmt/<mac addr>/SenHub/Action
|
MQTT Topic Format |
/WSNMgmt/<mac addr>/SenHub/Action
|
Method(HTTP/MQTT) |
GET/SUB
|
Request JSON Data |
N/A
|
Response JSON Data |
{
"result":{
"e":[
{
"n":"AutoReport",
"bv":1,
"asm":"rw"
}
]
}
}
|
Example |
curl -H "Content-Type: application/json" -X GET http://username:password@<IP:Port>/restapi/WSNMgmt/<mac addr>/SenHub/Action
|
Example |
mosquito_sub -h <IP> -C 1 -t /WSNMgmt/<mac addr>/SenHub/Action
|
Description |
Set the Sensor Hub to AutoReport.
|
URI Resource Path |
/WSNMgmt/<mac addr>/SenHub/Action/AutoReport
|
MQTT Topic Format |
/WSNMgmt/<mac addr>/SenHub/Action/AutoReport
|
Method(HTTP/MQTT) |
POST/PUB
|
Request JSON Data |
{
"bv":0
}
|
Response JSON Data |
{
"result":"true"
}
|
Example |
curl -H "Content-Type: application/json" -X POST -d '{"bv":0}' http://username:password@<IP:Port>/restapi/WSNMgmt/<mac addr>/SenHub/Action/AutoReport
|
Example |
mosquitto_pub -h <IP> -m '{"bv":0}' -t /WSNMgmt/<mac addr>/SenHub/Action/AutoReport
|
Description |
Retrieve the Sensor Hub all sensor data.
|
URI Resource Path |
/WSNMgmt/<mac addr>/SenHub/SenData
|
MQTT Topic Format |
/WSNMgmt/<mac addr>/SenHub/SenData
|
Method(HTTP/MQTT) |
GET/SUB
|
Request JSON Data |
N/A
|
Response JSON Data |
{
"result":{
"e":[
{
"n":"Ultrasonic",
"u":"cm",
"v":408.00,
"min":15,
"max":645,
"asm":"r",
"type":"d",
"rt":"ucum.cm",
"st":"ipso",
"exten":""
}
]
}
}
|
Example |
curl -H "Content-Type: application/json" -X GET http://username:password@<IP:Port>/restapi/WSNMgmt/<mac addr>/SenHub/SenData
|
Example |
mosquito_sub -h <IP> -C 1 -t /WSNMgmt/<mac addr>/SenHub/SenData
|
Description |
Retrieve the Sensor Hub network information.
|
URI Resource Path |
/WSNMgmt/<mac addr>/SenHub/Net
|
MQTT Topic Format |
/WSNMgmt/<mac addr>/SenHub/Net
|
Method(HTTP/MQTT) |
GET/SUB
|
Request JSON Data |
N/A
|
Response JSON Data |
{
"result":{
"e":[
{
"n":"Health",
"v":100,
"asm":"r"
},
{
"n":"Neighbor",
"sv":"00170d0000582cca",
"asm":"r"
},
{
"n":"sw",
"sv":"1.0.00",
"asm":"r"
}
]
}
}
|
Example |
curl -H "Content-Type: application/json" -X GET http://username:password@<IP:Port>/restapi/WSNMgmt/<mac addr>/SenHub/Net
|
Example |
mosquito_sub -h <IP> -C 1 -t /WSNMgmt/<mac addr>/SenHub/Net
|
API Management Resources
Description |
Retrieve all API resources, and API version.
|
URI Resource Path |
/APIInfoMgmt/APIInfo
|
MQTT Topic Format |
/APIInfoMgmt/<mac addr>/APIInfo
|
Method(HTTP/MQTT) |
GET/SUB
|
Request JSON Data |
N/A
|
Response JSON Data |
{
"result":{
"Mgmt":{
"item":[
"APIInfoMgmt",
"WSNMgmt",
"AccountMgmt",
"SystemMgmt",
"ProcessMgmt"
]
},
"totalsize":5,
"version":"1.0.0"
}
}
|
Example |
curl -H "Content-Type: application/json" -X GET http://username:password@<IP:Port>/restapi/APIInfoMgmt/APIInfo
|
Example |
mosquito_sub -h <IP> -C 1 -t /APIInfoMgmt/<mac addr>/APIInfo
|