States
Read Last
Read last state(s) | ||
type | object | |
properties | ||
| The device unique identifier. Device Unique ID / Device External key | |
type | string (UUID) / string | |
| The parent unique identifier. Product Unique ID / Location Unique ID / Device Unique ID | |
type | string (UUID) | |
Response
type | array | ||
items | type | object | |
properties | |||
| Product Unique ID, Channel External key and .desired / .reported | ||
type | string | ||
pattern | product_uid:external_key.(desired|reported) / product_uid:external_key.(lat|lon|alt|pdop|hdop|vdop|sats).(desired|reported) | ||
| State value | ||
type | boolean / number / string | ||
| State error | ||
type | number (POSIX error) | ||
| State aggregation | ||
enum | derivative.1s, derivative.1m, derivative.1h, last | ||
| The device unique identifier. Device Unique ID | ||
type | string (UUID) | ||
| State date/time | ||
type | number (Unix time) | ||
Notes
Request device and entity are mutually exclusive.
Response value and error are mutually exclusive.
Response timestamp is in decimal seconds with millisecond precision.
Example request
GET https://interay.io/api/v1/states/read/last?device=00000000-0000-0000-0000-000000000000
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Example response
200 OK
Content-Type: application/json
[
{
"channel": "99999999-9999-9999-9999-999999999999:modbus_1.reported",
"value": 1.0,
"aggregated": "last",
"entity": "00000000-0000-0000-0000-000000000000",
"timestamp": 1767222000.001
},
{
"channel": "99999999-9999-9999-9999-999999999999:modbus_2.reported",
"error": -11,
"aggregated": "last",
"entity": "00000000-0000-0000-0000-000000000000",
"timestamp": 1767222000.001
}
]
Read History
Read state(s) | |||
type | object | ||
properties | |||
| type | array | |
items | The device unique identifier. Device Unique ID / Device External key | ||
type | string (UUID) / string | ||
| type | array | |
items | The parent unique identifier. Product Unique ID / Location Unique ID / Device Unique ID | ||
type | string (UUID) | ||
| type | array | |
items | Channel External key and .desired / .reported | ||
type | string | ||
pattern | external_key.(desired|reported) / external_key.(lat|lon|alt|pdop|hdop|vdop|sats).(desired|reported) | ||
| The beginning of the queried time range | ||
type | number (Unix time) / string (Duration) / string (ISO 8601) | ||
| The end of the queried time range | ||
type | number (Unix time) / string (Duration) / string (ISO 8601) | ||
| The period of aggregated data | ||
type | number (seconds) / string (Duration) | ||
Response
type | array | ||
items | type | object | |
properties | |||
| Product Unique ID, Channel External key and .desired / .reported | ||
type | string | ||
pattern | product_uid:external_key.(desired|reported) / product_uid:external_key.(lat|lon|alt|pdop|hdop|vdop|sats).(desired|reported) | ||
| State value | ||
type | boolean / number / string | ||
| State error | ||
type | number (POSIX error) | ||
| State aggregation | ||
enum | derivative.1s, derivative.1m, derivative.1h, last, max, mean, min | ||
| The device unique identifier. Device Unique ID | ||
type | string (UUID) | ||
| State date/time | ||
type | number (Unix time) | ||
Notes
Request devices and entities are mutually exclusive.
Request timeRangeStart and timeRangeStop should have a negative Duration.
Response value and error are mutually exclusive.
Response timestamp is in decimal seconds with millisecond precision.
Example request
GET https://interay.io/api/v1/states/read?devices=00000000-0000-0000-0000-000000000000&timeRangeStart=-1d
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Example response
200 OK
Content-Type: application/json
[
{
"channel": "99999999-9999-9999-9999-999999999999:modbus_1.reported",
"value": 1.0,
"aggregated": "last",
"entity": "00000000-0000-0000-0000-000000000000",
"timestamp": 1767222000.001
},
{
"channel": "99999999-9999-9999-9999-999999999999:modbus_2.reported",
"error": -11,
"aggregated": "last",
"entity": "00000000-0000-0000-0000-000000000000",
"timestamp": 1767222000.001
}
]
Write
Write state(s) | ||||
type | object | |||
properties | ||||
| The device unique identifier. Device Unique ID / Device External key | |||
type | string (UUID) / string | |||
| The device state(s) | |||
type | array | |||
items | type | object | ||
properties | ||||
| Channel External key and .desired / .reported | |||
type | string | |||
pattern | external_key.(desired|reported) / external_key.(lat|lon|alt|pdop|hdop|vdop|sats).(desired|reported) | |||
| State value | |||
type | boolean / number / string | |||
| State error | |||
type | number (POSIX error) | |||
| State date/time | |||
type | number (Unix time) / string (ISO 8601) | |||
default | Server’s current time | |||
Notes
Request value and error are mutually exclusive.
Request error is only allowed for .reported.
Negative error values are displayed as POSIX errors descriptions.
Example request desired
POST https://interay.io/api/v1/states/write
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Content-Type: application/json
{
"device": "00000000-0000-0000-0000-000000000000",
"states": [
{
"channel": "modbus_1.desired",
"value": 1.0,
},
{
"channel": "modbus_2.desired",
"value": 2.0,
}
]
}
Example response desired
200 OK
Example request reported
POST https://interay.io/api/v1/states/write
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Content-Type: application/json
{
"device": "00000000-0000-0000-0000-000000000000",
"states": [
{
"channel": "modbus_1.reported",
"value": 1.0,
"timestamp": "2019-09-26T07:58:30.996+0200",
},
{
"channel": "modbus_2.reported",
"error": -11,
"timestamp": "2019-09-26T07:58:30.996+0200",
}
]
}
Example response reported
200 OK