This API allows users to interact with their devices, retrieve information, update configurations, and manage schedules and logs. Below is the list of available endpoints and example request/response formats.
GET /devices
Fetch a list of all devices linked to the current user.
{
"devices": [
{
"id": "DEVICE123",
"name": "Temperature Sensor",
"status": "active",
"config": { "samplingRate": "10s", "threshold": 40 }
}
]
}
GET /device/:deviceId
Retrieve detailed information about a specific device.
{
"device": {
"id": "DEVICE123",
"name": "Temperature Sensor",
"status": "active",
"config": { "samplingRate": "10s", "threshold": 40 }
}
}
GET /device/:deviceId/schedules
Retrieve schedules for the specified device.
{
"schedules": [
{ "sound": "Alarm", "date": "2024-01-01", "time": "10:00" }
]
}
POST /device/:deviceId/schedules
Add a new schedule to the specified device.
{
"sound": "Alarm",
"date": "2024-01-01",
"time": "10:00"
}
{
"message": "Schedule added successfully"
}
GET /device/:deviceId/logs
Retrieve logs for the specified device.
{
"logs": [
{ "sensor": "Temperature", "value": 35.6, "timestamp": "2024-10-12T10:00:00Z" }
]
}
POST /device/:deviceId/logs
Submit sensor data and logs from the device, and receive the latest configuration.
{
"sensors": [{ "sensor": "Temperature", "value": 35.6 }],
"status": "active",
"config": { "samplingRate": "10s" },
"schedule": [],
"sound": {}
}
{
"message": "Log data saved successfully",
"config": { "samplingRate": "5s", "threshold": 45 }
}
POST /device/:deviceId/config
Update the configuration settings of a specific device.
{
"config": { "samplingRate": "5s", "threshold": 45 }
}
{
"message": "Device config updated successfully"
}