Readings
Endpoints
GET
/api/v1/org/{org_id}/proj/{proj_id}/readings/{sensor_id}
URL Parameters
Key | Type | Description |
---|---|---|
org_id |
number |
The ID of the organization. |
proj_id |
number |
The ID of the project within the organization. |
sensor_id |
number |
The ID of the sensor within the project. |
Query Parameters
Key | Type | Example Value | Description |
---|---|---|---|
datetime__gte |
string |
2023-10-07T07:00:13Z |
Greater than or equal to the specified datetime. |
datetime__lte |
string |
2023-11-07T07:00:13Z |
Less than or equal to the specified datetime. |
outputs |
boolean |
true |
Include calculated outputs. The default value is false . |
limit |
number |
1000 |
Maxmimum number of readings that should be returned. The default value is 1000 .The maximum value is 1000 . |
offset |
number |
0 |
Offset of the requested readings. The default value is 0 . |
Example Request
GET
/api/v1/org/12/proj/34/readings/56?outputs=true&datetime__gte=2023-10-07T07:00:13Z
Example Response Body
[
{
"id": "a2bd1159c29ca76977c7197e02683db5",
"datetime": "2023-11-01T05:02:40.653Z",
"inputs": {
"7849": 107.83,
"7850": 203.53
},
"outputs": {
"8833": 333.83,
"8834": 444.53
}
},
{
"id": "cb18189b7cde24f3b32e91406a8c0e0f",
"datetime": "2023-11-01T06:02:40.659Z",
"inputs": {
"7849": 107.84,
"7850": 203.18
},
"outputs": {
"8833": 333.84,
"8834": 444.18
}
}
]
POST
/api/v1/org/{org_id}/proj/{proj_id}/readings/{sensor_id}
URL Parameters
Key | Type | Description |
---|---|---|
org_id |
number |
The ID of the organization. |
proj_id |
number |
The ID of the project within the organization. |
sensor_id |
number |
The ID of the sensor within the project. The readings in the request body will belong to this sensor. |
Example Request
POST
/api/v1/org/12/proj/34/readings/56
Example Request Body
Only the datetime
and inputs
need to be provided per reading, the {sensor_id}
parameter in the request URL determines which sensor these readings belong to. This means that all of the readings in the request body must belong to the same sensor. If you want to create readings for multiple sensors, you will need to create them one sensor at a time. Note that only the inputs are stored in the database, the outputs are calculated on the fly when viewing the data in Sensly.
Readings that have the same datetime
will be overwritten.
[
{
"datetime": "2023-11-01T05:02:40.653629Z",
"inputs": {
"7849": 107.83,
"7850": 203.53
}
},
{
"datetime": "2023-11-01T06:02:40.653629Z",
"inputs": {
"7849": 107.84,
"7850": 203.18
}
}
]
Example Response Body
"OK"
Input IDs
The input IDs can be found by revealing them on the Blueprint > Formulas setup page. Note that these input IDs will differ between blueprints, as a unique instance of a blueprint is created each time.