curl --request POST \
--url https://devices.agrihub360.example/api/metric-values \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"device_id": "77777777-7777-7777-7777-777777777703",
"metric_id": 220,
"value": 42.5
}
'{
"device_id": "77777777-7777-7777-7777-777777777703",
"metric_id": 220,
"value": "42.5",
"timestamp": "1784367787126"
}Post a reading
Stores one reading for one device. The body names the device, the
metric and the value. The server assigns the timestamp on arrival; any
timestamp in the request is ignored.
On success the stored row is returned with a 201. The reading is also
published to the live-updates message bus. That publish is best-effort
and never fails the request.
One reading per request. There is no batch endpoint. Each device credential is limited to 120 requests per 60 seconds.
curl --request POST \
--url https://devices.agrihub360.example/api/metric-values \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"device_id": "77777777-7777-7777-7777-777777777703",
"metric_id": 220,
"value": 42.5
}
'{
"device_id": "77777777-7777-7777-7777-777777777703",
"metric_id": 220,
"value": "42.5",
"timestamp": "1784367787126"
}Authorizations
The device's API key, sent as Authorization: Bearer <api_key>. Issued
per device in the app and shown once. Issuing a new key revokes the
previous one.
Body
One reading. A timestamp is not accepted; the server assigns it.
The id of a device claimed in the app.
"77777777-7777-7777-7777-777777777703"
What was measured, from the shared metric catalogue. 220 is soil moisture in percent.
220
The reading, as a number or a numeric string. Stored and returned as a string. Units are not converted.
42.5
Response
Reading stored. The body is the stored row.
A stored reading.
"77777777-7777-7777-7777-777777777703"
220
The stored reading, always a string.
"42.5"
Server-assigned time of arrival in epoch milliseconds, serialised as a string.
"1784367787126"