Skip to main content

Get Latest Readings

Retrieve the most recent sensor readings, optionally filtered by greenhouse.

Query Parameters

greenhouseId
string
ID of the greenhouse to filter by (defaults to “001”)
limit
integer
default:"10"
Maximum number of readings to return

Response

time
string
Timestamp of the reading (ISO 8601)
sensorId
string
Unique identifier for the sensor
greenhouseId
long
ID of the greenhouse
tenantId
long
ID of the tenant owning this reading
sensorType
string
Type of sensor (TEMPERATURE, HUMIDITY, CO2, LIGHT, etc.)
value
number
Numeric value of the reading
unit
string
Unit of measurement (°C, %, ppm, lux, etc.)

Example Request

curl -X GET "https://api.example.com/api/v1/sensors/latest?greenhouseId=001&limit=20" \
  -H "Accept: application/json"

Example Response

[
  {
    "time": "2025-03-03T14:30:00Z",
    "sensorId": "TEMP_01",
    "greenhouseId": 123456789,
    "tenantId": 987654321,
    "sensorType": "TEMPERATURE",
    "value": 22.5,
    "unit": "°C"
  },
  {
    "time": "2025-03-03T14:30:00Z",
    "sensorId": "HUM_01",
    "greenhouseId": 123456789,
    "tenantId": 987654321,
    "sensorType": "HUMIDITY",
    "value": 65.0,
    "unit": "%"
  }
]

Get Readings by Greenhouse

Retrieve all sensor readings for a specific greenhouse within a time window.

Path Parameters

greenhouseId
string
required
ID of the greenhouse

Query Parameters

hours
number
default:"24"
Number of hours to look back from now

Response

Returns an array of sensor readings (same structure as “Get Latest Readings”).

Example Request

curl -X GET "https://api.example.com/api/v1/sensors/by-greenhouse/001?hours=48" \
  -H "Accept: application/json"

Get Readings by Sensor ID

Retrieve all readings for a specific sensor within a time window.

Path Parameters

sensorId
string
required
Unique identifier for the sensor

Query Parameters

hoursAgo
number
default:"24"
Number of hours to look back from now

Response

Returns an array of sensor readings ordered by time.

Example Request

curl -X GET "https://api.example.com/api/v1/sensors/by-sensor/TEMP_01?hoursAgo=24" \
  -H "Accept: application/json"

Get Current Sensor Values

Retrieve the current (most recent) values for all sensors in a greenhouse.

Query Parameters

greenhouseId
long
required
ID of the greenhouse

Response

Returns a map of sensor data with the latest value for each sensor.

Example Request

curl -X GET "https://api.example.com/api/v1/sensors/current?greenhouseId=123456789" \
  -H "Accept: application/json"

Example Response

{
  "TEMP_01": {
    "value": 22.5,
    "unit": "°C",
    "timestamp": "2025-03-03T14:30:00Z"
  },
  "HUM_01": {
    "value": 65.0,
    "unit": "%",
    "timestamp": "2025-03-03T14:30:00Z"
  },
  "CO2_01": {
    "value": 450.0,
    "unit": "ppm",
    "timestamp": "2025-03-03T14:30:00Z"
  }
}

Build docs developers (and LLMs) love