The API Route is available under http://<host>/api as POST Method via JSON Objects.
The API Route provides some Debug Responses
This Error occurs if you use an API Type which is unknown or was deprecated.
{"type":"error","message":"Not implemented"}
This Error occurs if your requesting JSON Frame is wrong.
{"type":"error","message":"Invalid request"}
This Error occurs if the Software has problems parsing your JSON Request.
{"type":"error","message":"No JSON payload provided"}
The Board comes with two Relais (max 10 A at 24 VDC) wich can be controlled via the HTTP POST API.
The Relais on the Board can be toggled via the Relai Type, the Channel is the Relai (eq. Relais 1 or Relais 2).
In this Example the Relais on Channel 1 is turned on.
{
"type": "relais",
"channel": 1,
"state": true
}The Relais on the Board can be turned on for a specified Time and then automatically turned off.
In this Example the Relais on Channel 1 is turned on for 1 Minute.
{
"type": "relais",
"channel": 1,
"duration": 60,
"state": true
}You can retrieve the Device Status by using the Status Type.
{
"type": "status"
}This will return the current Status:
{
"type": "success",
"channels": [
1,
0
],
"adc": "1.10",
"cpu": "10.5",
"frequency": 160
}You can restart the Device via the Restart Type.
{
"type": "restart"
}You can reset the Device Config by using the Reset Type.
{
"type": "reset"
}You can retrieve the Device Info by using the Info Type.
{
"type": "info"
}This will return the current Status:
{
"type": "success",
"wifi": {
"client": {
"ssid": "",
"password": ""
},
"ap": {
"ssid": "BYTELEVEL",
"password": "BYTESTORE2026"
}
},
"mqtt": {
"state": false,
"host": "",
"port": 1883,
"user": "",
"password": ""
},
"admin": {
"state": false,
"user": "",
"password": ""
},
"hardware": {
"led": true
},
"firmware": "1.0.1"
}When you enable Authentification for the UI, the API will be becoming protected via the Admin Credentials.
Because this is a non-High-Security-Device, it just uses Basic Auth.
You need to replace as username:password decoded as Base64 String.
curl --location 'http://<host>/api' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic <base64-encoded-password>' \
--data '{
"type": "info"
}'