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.

Updates or creates a configuration property on a device owned by the authenticated user. Properties are key-value pairs (both stored as strings) that configure device behavior such as automation thresholds and hardware capabilities. Each update is recorded in the device’s log as a COMMAND entry.

Endpoint

FieldValue
MethodPUT
Path/api/my-devices/{id}/properties
AuthBearer token required (Authorization: Bearer YOUR_TOKEN)

Path Parameters

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

Request Body

property_key
string
required
The name of the property to create or update (e.g. "humidity_threshold", "auto_water"). Must be a non-empty string.
property_value
string
required
The new value for the property. Always provided as a string, even for boolean or numeric values (e.g. "true", "45").

Common Property Keys

KeyExample ValueDescription
auto_water"true"Enable automatic watering when humidity drops below threshold
humidity_threshold"45"Humidity percentage that triggers the auto_water pump
has_pump"true"Indicates the device has a pump actuator
has_humidity"true"Indicates the device has a soil humidity sensor
has_light"false"Indicates the device has a light sensor

Request Example

curl -X PUT http://localhost/api/my-devices/1/properties \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"property_key": "humidity_threshold", "property_value": "45"}'

Responses

200 OK

The property was created or updated successfully. A COMMAND log entry is written to device_logs capturing which key was changed and its new value.
{
  "status": "success",
  "message": "Configuración guardad correctamente"
}
status
string
Always "success" on a 200 response.
message
string
Confirmation that the configuration was saved. The message text is returned verbatim from the controller.

404 Not Found

The device does not exist or does not belong to the authenticated user.
{
  "status": "error",
  "message": "Dispositivo no encontrado"
}

422 Unprocessable Entity

One or both required fields (property_key, property_value) are missing or not strings.
{
  "message": "The property key field is required.",
  "errors": {
    "property_key": ["The property key field is required."]
  }
}

To update multiple properties, call this endpoint once per property key. Each call is an upsert — it creates the property if it doesn’t exist, or overwrites the existing value if it does.

Build docs developers (and LLMs) love