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 the full detail of a single sensor reading by its database ID. The response includes eager-loaded device name and sensor type details (name and measurement unit).

Endpoint

GET /api/sensor-data/{id} Auth: None required. This is a public apiResource route.

Path Parameters

id
integer
required
The numeric primary key of the sensor reading to retrieve. Must correspond to an existing record in the sensor_data table.

Example Request

curl -X GET http://localhost/api/sensor-data/42

Responses

200 OK

The reading was found. Returns the full record with eager-loaded device and sensor_type relationships.
{
  "status": "success",
  "data": {
    "id": 42,
    "device_id": 3,
    "sensor_type_id": 2,
    "reading_value": 73.5,
    "recorded_at": "2024-01-15T10:30:00.000000Z",
    "device": {"id": 3, "name": "Invernadero A"},
    "sensor_type": {"id": 2, "name": "Humedad del suelo", "unit": "%"}
  }
}
status
string
Always "success" on a 200 response.
data
object
The full sensor reading record.

404 Not Found

No sensor reading with the given id exists in the database.
{"status": "error", "message": "Lectura no encontrada"}

Build docs developers (and LLMs) love