Get collection data
GET/homes/{homeId}/smartModules/{moduleId}/collections/{collectionId}/data
Base URL: https://api.tinkermode.com
Get the collection data specified by collection ID. Use the begin and end parameters to fetch entries by time range, with the proper time resolution automatically applied.
You need to specify the selectValues parameter to specify which value fields of the collection should be returned.
Use the ts and limit parameters to fetch a specific number of raw data entries before or after a point in time. When the optional param tsEnd is provided, the data entries will be fetched from ts to tsEnd.
When raw data entries are being fetched, you can retrieve value fields using the
selectValues parameter, and retrieve tag fields using the selectTags parameter.
(You need to specify either or both of these parameters.)
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. | |
collectionId | string | Yes | Collection 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 time of the data entries. The format follows RFC3339. | |
end | string | No | The end time of the data entries. The format follows RFC3339. | |
limit | integer | No | If positive, this is the maximum number of data entries
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. | |
selectTags | string | No | A comma-delimited list of tag names. This is used only when fetching entries
with the ts and limit parameters. If data entries contain tags, use this
parameter to return the desired tag fields.
| |
selectValues | string | No | A comma-delimited list of value names. Since each data entry in the collection contains multiple value fields, the fields to be returned must be specified | |
ts | string | No | The point in time (in RFC3339) to fetch data entries from. | |
tsEnd | string | No | The point in time (in RFC3339) to fetch data entries to. |
Responses
200 The requested collection data entries 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 begin time of data entries. The format follows RFC3339. |
collectionId | string | No | read-only (server-generated); pattern: ^[a-zA-Z0-9]([a-zA-Z0-9\-_\:]*[a-zA-Z0-9])*$ | Time Series Collection ID. Must be unique within each home. Must be unique within each home. Must be 1 or more alphanumeric characters and may contain dashes ('-'), underscores ('_'), and colons (':') may be used after the first character but must be followed by 1+ alphanumeric characters. |
data | array | No | read-only (server-generated) | Collection data. Each entry is an array as tuple and the first item is timestamp of the value in RFC3339 format, followed by the selected values and tags. e.g. [["2016-01-01T00:00:00Z", 1.0, 333, "foo"], ["2016-01-02T00:00:00Z", 2.0, 299, "bar"]] |
end | string | No | read-only (server-generated) | The end time of data entries. The format follows RFC3339. |
limit | integer | No | read-only (server-generated) | The maximum number of data entries 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. |
ts | string | No | read-only (server-generated) | The point in time (in RFC3339) from which data entries were fetched. |
Response example
{
"aggregation": "avg",
"begin": "2019-04-11T07:51:46.712Z",
"collectionId": "room1-metrics",
"data": [
[
"2019-04-11T00:00:00Z",
22.97349639133924,
0.66,
772
],
[
"2019-04-12T00:00:00Z",
22.916217542079057,
0.77,
899
],
[
"2019-04-13T00:00:00Z",
21.939217256214157,
0.8,
502
],
[
"2019-04-14T00:00:00Z",
21.668999574649146,
0.5,
888
],
[
"2019-04-15T00:00:00Z",
23.01144695453247,
0.55,
890
],
[
"2019-04-16T00:00:00Z",
23.877712361878466,
0.63,
792
],
[
"2019-04-17T00:00:00Z",
24.251540345449843,
0.45,
662
],
[
"2019-04-18T00:00:00Z",
23.900341664030382,
0.8,
705
],
[
"2019-04-19T00:00:00Z",
23.579976112920807,
0.78,
780
]
],
"end": "2020-01-29T01:26:08.101Z",
"resolution": "1day"
}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. |