Skip to content

IoT TS Aggregates Client for Java

Introduction

The IoT TS Aggregates Java client allows you to query aggregated time series data. Refer to IoT TS Aggregates for more information about the service.

Hint

In the IoT context, assets are referred to as entity and aspects as propertyset.
Placeholders in the following samples are indicated by angular brackets < >.

TS Aggregates Operations

Client name: AggregatesClient

Read Aggregated Time Series

This section shows two options for reading aggregated time series data of a specific aspect of an asset from the specified time range. This feature is only available if aspect data is available within the specified time range.

Note

A query can only return up to 200 aggregate intervals in one response.
Aggregates can only be created from up to 5,000 raw time series entries.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
// Construct the AggregatesClient object
AggregatesClient aggregate_client =  AggregatesClient.builder()
                                            .mindsphereCredentials(<credentials>)
                                            .restClientConfig(<config>)
                                            .build();

List<Aggregates> aggregate_list = null;
try {
  aggregate_list = aggregate_client.getAggregateTimeseries(<entity_id>, <property_set>, <from>, <to>, <interval_value>, <interval_unit>, <select>);
} catch (MindsphereException e) {
  // Exception handling
}

Alternatively, use the GetAggregateTimeseriesRequest model.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
// Construct the AggregatesClient object as shown above

GetAggregateTimeseriesRequest request_object = new GetAggregateTimeseriesRequest();
request_object.setEntity(<entity_id>);
request_object.setPropertyset(<property_set>);
request_object.setFrom(<from>);
request_object.setTo(<to>);
request_object.setIntervalValue(<interval_value>);
request_object.setIntervalUnit(<interval_unit>);
request_object.setSelect(<select>);

List<Aggregates> aggregate_list = null;
try {
  aggregate_list = aggregate_client.getAggregateTimeseries(request_object);
} catch (MindsphereException e) {
  // Exception handling
}

Any questions left?

Ask the community


Except where otherwise noted, content on this site is licensed under the MindSphere Development License Agreement.