Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/GaelCeballos/Smart_Enviro_Backend/llms.txt

Use this file to discover all available pages before exploring further.

Returns a list of all devices assigned to the authenticated user. Each device includes online status, current actuator state, hardware capability flags derived from device properties, and the latest humidity reading (sensor_type_id=1).

GET /api/my-devices

Returns every device owned by the authenticated user. Device properties stored in the database (e.g. has_pump, has_humidity, has_light) are resolved into a structured capabilities object. The last_humidity value is taken from the most recent SensorData row where sensor_type_id = 1.
FieldValue
MethodGET
Path/api/my-devices
AuthBearer token required (Authorization: Bearer YOUR_TOKEN)

Request

No query parameters or request body.
curl -X GET http://localhost/api/my-devices \
  -H "Authorization: Bearer YOUR_TOKEN"

Response (200 OK)

{
  "status": "success",
  "data": [
    {
      "id": 1,
      "name": "Invernadero A",
      "is_online": true,
      "current_state": "STANDBY",
      "capabilities": {
        "has_pump": true,
        "has_humidity": true,
        "has_light_sensor": false
      },
      "last_humidity": 73.5
    }
  ]
}
status
string
Always "success" for a 200 response.
data
array
Array of device objects belonging to the authenticated user.

GET /api/my-devices/

Returns detailed information about a single device owned by the authenticated user. The response includes the device’s current settings, capability flags, and up to 20 recent sensor history entries.
FieldValue
MethodGET
Path/api/my-devices/{id}
AuthBearer token required

Path Parameters

id
integer
required
The unique ID of the device to retrieve. The device must belong to the authenticated user.

Request

curl -X GET http://localhost/api/my-devices/1 \
  -H "Authorization: Bearer YOUR_TOKEN"

Response (200 OK)

{
  "status": "success",
  "data": {
    "id": 1,
    "name": "Invernadero A",
    "is_online": true,
    "state": "STANDBY",
    "settings": {
      "auto_water": false,
      "humidity_threshold": 40
    },
    "capabilities": {
      "has_pump": true,
      "has_humidity": true
    },
    "history": [
      {"value": 73.5, "type": "humedad_suelo", "date": "2024-01-15T10:30:00.000000Z"}
    ]
  }
}
status
string
Always "success" for a 200 response.
data
object
Detailed device object.

Response (404 Not Found)

Returned when no device with the given id belongs to the authenticated user.
{
  "status": "error",
  "message": "Dispositivo no encontrado"
}

Build docs developers (and LLMs) love