Get time series data
GET/homes/{homeId}/smartModules/{moduleId}/timeSeries/{seriesId}/data
Base URL: https://api.tinkermode.com
Get the time series data specified by series ID. Use the begin and end
parameters to fetch values by time range, with the proper time resolution
automatically applied. Use the ts and limit parameters to fetch a specific
number of data points before or after a point in time. When the optional param
tsEnd is provided, the data points will be fetched from ts to tsEnd.
Authentication
Send an Authorization header of the form ModeCloud <AUTH_CODE>.
Must contain a user, service account, or project API key.
Path parameters
| Name | Type | Required | Constraints | Description |
|---|---|---|---|---|
homeId | integer | Yes | The unique id for a home. | |
moduleId | string | Yes | The unique id for a smart module. | |
seriesId | string | Yes | Series ID. It must be unique per home. |
Query parameters
| Name | Type | Required | Constraints | Description |
|---|---|---|---|---|
aggregation | string | No | Aggregation function. The string must be either 'avg', 'min', 'max', 'sum' or 'count'. 'avg' is chosen if not provided. | |
begin | string | No | The beginning of the time series data. The format follows RFC3339. | |
end | string | No | The end of the time series data. The format follows RFC3339. | |
limit | integer | No | If positive, this is the maximum number of data points
at and after ts to be returned. If negative, this is the maximum
number of data points before ts to be returned.
When tsEnd is specified, the positive limit should have ts before tsEnd and
the negative limit should have ts after tsEnd.
| |
resolution | string | No | The resolution of time bucket. The string must be either '5sec', '15sec', '1min', '10min', '1hour', '1day', '1week', '1month'. Decided automatically based on the timespan between "begin" and "end" parameters if not provided. | |
skipNullRecords | boolean | No | If true, skip any records whose values are all null. False by default. | |
ts | string | No | The point in time (in RFC3339) to fetch data points from. | |
tsEnd | string | No | The point in time (in RFC3339) to fetch data points to. |
Responses
200 The requested time series data points are returned.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
aggregation | string | No | read-only (server-generated); one of: avg, min, max, sum, count | Aggregation method used. |
begin | string | No | read-only (server-generated) | The beginning of the time series data. The format follows RFC3339. |
data | array | No | read-only (server-generated) | Time series data. Each item is an array as tuple and the first item is timestamp of the value in RFC3339 format and the second is the value. |
end | string | No | read-only (server-generated) | The end of the time series data. The format follows RFC3339. |
limit | integer | No | read-only (server-generated) | The maximum number of data points to be fetched. |
resolution | string | No | read-only (server-generated); one of: 1min, 10min, 1hour, 1day, 1week, 1month | Aggregation bucket resolution. Its value depends on the time span of the query. |
seriesId | string | No | read-only (server-generated); pattern: ^[a-zA-Z0-9]([a-zA-Z0-9\-_\:]*[a-zA-Z0-9])*$ | Time Series ID. Must be unique within each home. Must be 1 or more alphanumeric characters; dashes ('-'), underscores ('_'), and colons (':') may be used after the first character but must be followed by 1+ alphanumeric characters. |
ts | string | No | read-only (server-generated) | The point in time (in RFC3339) from which data points were fetched. |
Response example
{
"aggregation": "avg",
"begin": "2019-04-11T07:51:46.712Z",
"data": [
[
"2019-04-11T00:00:00Z",
22.97349639133924
],
[
"2019-04-12T00:00:00Z",
22.916217542079057
],
[
"2019-04-13T00:00:00Z",
21.939217256214157
],
[
"2019-04-14T00:00:00Z",
21.668999574649146
],
[
"2019-04-15T00:00:00Z",
23.01144695453247
],
[
"2019-04-16T00:00:00Z",
23.877712361878466
],
[
"2019-04-17T00:00:00Z",
24.251540345449843
],
[
"2019-04-18T00:00:00Z",
23.900341664030382
],
[
"2019-04-19T00:00:00Z",
23.579976112920807
]
],
"end": "2020-01-29T01:26:08.101Z",
"resolution": "1day",
"seriesId": "room1-temperature"
}401 Authorization is required to access this resource.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |
403 Request failed because of denied permission.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |
404 The requested data does not exist or is not accessible.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |
429 Request failed because of rate limit.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |
500 An unexpected error has occurred.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |
503 The service is temporarily unavailable.
Content type: application/json
| Property | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | No | read-only (server-generated) | Any relevant data related to error. |
reason | string | Yes | read-only (server-generated) | Reason of error. |