Library HTTP API Under development
When device is in configuration mode, a HTTP API is running that can help with provisioning the device. Make sure you are connected to the device hotspot before making HTTP requests. Once the connection is successful, the HTTP API is hosted on http://192.168.4.1
POST /config
Accepts a JSON payload with device credentials and network configuration. There are 3 examples of network configuration wifi
, ethernet
, gsm
json
{
"deviceId": "device id value",
"deviceToken": "device token value",
"wifi": {
"ssid": "ssid value",
"password": "password value"
}
}
json
{
"deviceId": "device id value",
"deviceToken": "device token value",
"gsm": {
"apn": "apn value",
"password": "password value"
}
}
json
{
"deviceId": "device id value",
"deviceToken": "device token value",
"ethernet": {
"ip": "192.168.0.24",
}
}
Response
200 OK
json
{
"status": "OK"
}
400 Bad request
json
{
"message": "A detailed message"
}
GET /networks WiFi board
Return available WiFi networks that are in range. Works only for boards that have WiFi functionality.
Response
200 OK
json
[
{
"ssid": "ssid name",
"password": "password",
"security": "WPA2",
"rssi": "-94"
},
{
"ssid": "ssid name 2",
"password": "password 2",
"security": "WPA-PSK",
"rssi": "-100"
},
]
400 Bad request
json
{
"message": "A detailed message"
}
GET /info
Return device information and array of nodes.
Response
200 OK
json
{
"name": "ESP 32",
"manufacturer": "Sensora",
"fw_v": "0.0.1",
"fw_checksum": "79054025255fb1a26e4bc422aef54eb4",
"status": 1,
"uptime": 420,
"freeheap": 69420,
"properties": ["light", "fan"]
}
POST /restart
Trigger restart of the device.
Response
200 OK
json
{
"status": "OK",
}
POST /reset
Reset the device configuration to default state.
Response
200 OK
json
{
"status": "OK",
}