Difference between revisions of "IoTGateway/RESTful APIv2 QuickGuide"

From ESS-WIKI
Jump to: navigation, search
Line 53: Line 53:
 
  }   
 
  }   
 
|-
 
|-
| Example || curl -H "Content-Type: application/json" -X GET http://username:password@<IP:Port>/restapi
+
| Example || curl -H "Content-Type: application/json" -X GET http://username:password@<IP:Port>/restapi/WSNMgmt/IoTGW/WSN/<mac addr>/Setting
/WSNMgmt/IoTGW/WSN/<mac addr>/Setting
 
 
|-
 
|-
 
| Example || mosquito_sub -h <IP> -C 1 -t /WSNMgmt/IoTGW/WSN/<mac addr>/Setting
 
| Example || mosquito_sub -h <IP> -C 1 -t /WSNMgmt/IoTGW/WSN/<mac addr>/Setting
Line 83: Line 82:
  
 
|-
 
|-
| Example || curl -H "Content-Type: application/json" -X POST -d '{"sv":"1234"}'  
+
| 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
http://username:password@<IP:Port>/restapi
 
/WSNMgmt/IoTGW/WSN/<mac addr>/Setting/NetID
 
  
 
|-
 
|-
Line 114: Line 111:
  
 
|-
 
|-
| Example || curl -H "Content-Type: application/json" -X POST -d '{"sv":"DUSTNETWORKSROCK"}'  
+
| 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
http://username:password@<IP:Port>/restapi
 
/WSNMgmt/IoTGW/WSN/<mac addr>/Setting/JoinKey
 
  
  

Revision as of 09:47, 1 June 2016

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

Header text Header text
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
Header text Header text
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
Header text Header text
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