Skip to content

IoT Time Series Aggregates Service – Samples

Requesting Aggregated Data

Performance Entity

In this example, there is an asset type forklift with an aspect tireMonitor and with the variables pressure, temperature, and treadDepth. The pressure variable has a quality code value of Y while the others are N. An instance of forklift with an asset ID of 978528e7a124458f87c8f1d38fd9400f is defined.

The following call requests data aggregated into 4 minute intervals from 2017-05-01T00:08:00 until 2017-05-01T00:16:00Z for the tireMonitor aspect:

1
https://gateway.{region}-{environment}.{mindsphere-domain}/api/iottimeseries/v3/aggregates/978528e7a124458f87c8f1d38fd9400f/tireMonitor?from=2017-05-01T00:08:00Z&to=2017-05-01T00:16:00Z&select=pressure,temperature&intervalUnit=minute&intervalValue=4

The following response is returned for this request

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
[
    {
        "pressure": {
            "firsttime": "2017-05-01T00:09:00Z",
            "average": 93.75,
            "lasttime": "2017-05-01T00:12:00Z",
            "maxvalue": 95,
            "firstvalue": 93,
            "mintime": "2017-05-01T00:10:00Z",
            "lastvalue": 94,
            "countgood": 4,
            "countuncertain": 0,
            "countbad": 0,
            "sum": 375,
            "minvalue": 93,
            "maxtime": "2017-05-01T00:11:00Z",
        },
        "temperature": {
            "firsttime": "2017-05-01T00:09:00Z",
            "average": 44.25,
            "lasttime": "2017-05-01T00:12:00Z",
            "maxvalue": 45,
            "firstvalue": 43,
            "mintime": "2017-05-01T00:09:00Z",
            "lastvalue": 44,
            "countgood": 4,
            "countuncertain": 0,
            "countbad": 0,
            "sum": 177,
            "minvalue": 43,
            "maxtime": "2017-05-01T00:11:00Z"
        },
        "starttime": "2017-05-01T00:08:00Z",
        "endtime": "2017-05-01T00:12:00Z"
    },
    {
        "pressure": {
            "firsttime": "2017-05-01T00:13:00Z",
            "average": 95,
            "lasttime": "2017-05-01T00:16:00Z",
            "maxvalue": 96,
            "firstvalue": 95,
            "mintime": "2017-05-01T00:15:00Z",
            "lastvalue": 96,
            "countgood": 4,
            "countuncertain": 0,
            "countbad": 0,
            "sum": 380,
            "minvalue": 94,
            "maxtime": "2017-05-01T00:16:00Z"
        },
        "temperature": {
            "firsttime": "2017-05-01T00:13:00Z",
            "average": 44.5,
            "lasttime": "2017-05-01T00:16:00Z",
            "maxvalue": 45,
            "firstvalue": 44,
            "mintime": "2017-05-01T00:14:00Z",
            "lastvalue": 44,
            "countgood": 4,
            "countuncertain": 0,
            "countbad": 0,
            "sum": 178,
            "minvalue": 43,
            "maxtime": "2017-05-01T00:15:00Z"
        },
        "starttime": "2017-05-01T00:12:00Z",
        "endtime": "2017-05-01T00:16:00Z"
    }
]

Simulation Entity

The following call requests data aggregated into 1 millisecond intervals from 2017-05-01T00:08:00.001 until 2017-05-01T00:08:00.003Z for the tireMonitor aspect:

1
https://gateway.{region}-{environment}.{mindsphere-domain}/api/iottimeseries/v3/aggregates/978528e7a124458f87c8f1d38fd9400f/tireMonitor?from=2017-05-01T00:08:00.001Z&to=2017-05-01T00:08:00.003Z&select=pressure,temperature&intervalUnit=millisecond&intervalValue=1

The following response is returned for this request:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
[
    {
        "pressure": {
            "firsttime": "2017-05-01T00:08:00.001015Z",
            "average": 93.75,
            "lasttime": "2017-05-01T00:08:00.001018Z",
            "maxvalue": 95,
            "firstvalue": 93,
            "mintime": "2017-05-01T00:08:00.001016Z",
            "lastvalue": 94,
            "countgood": 4,
            "countuncertain": 0,
            "countbad": 0,
            "sum": 375,
            "minvalue": 93,
            "maxtime": "2017-05-01T00:08:00.001017Z",
        },
        "temperature": {
            "firsttime": "2017-05-01T00:08:00.001015Z",
            "average": 44.25,
            "lasttime": "2017-05-01T00:08:00.001018Z",
            "maxvalue": 45,
            "firstvalue": 43,
            "mintime": "2017-05-01T00:08:.001012Z",
            "lastvalue": 44,
            "countgood": 4,
            "countuncertain": 0,
            "countbad": 0,
            "sum": 177,
            "minvalue": 43,
            "maxtime": "2017-05-01T00:08:00.001019Z"
        },
        "starttime": "2017-05-01T00:08:00.001Z",
        "endtime": "2017-05-01T00:08:00.002Z"
    },
    {
        "pressure": {
            "firsttime": "2017-05-01T00:08:00.002015Z",
            "average": 95,
            "lasttime": "2017-05-01T00:08:00.2018Z",
            "maxvalue": 96,
            "firstvalue": 95,
            "mintime": "2017-05-01T00:08:00.002010Z",
            "lastvalue": 96,
            "countgood": 4,
            "countuncertain": 0,
            "countbad": 0,
            "sum": 380,
            "minvalue": 94,
            "maxtime": "2017-05-01T00:08:00.002019Z"
        },
        "temperature": {
            "firsttime": "2017-05-01T00:08:00.002014",
            "average": 44.5,
            "lasttime": "2017-05-01T00:08:00.2018Z",
            "maxvalue": 45,
            "firstvalue": 44,
            "mintime": "2017-05-01T00:08:00.002010Z",
            "lastvalue": 44,
            "countgood": 4,
            "countuncertain": 0,
            "countbad": 0,
            "sum": 178,
            "minvalue": 43,
            "maxtime": "2017-05-01T00:08:00.002011Z"
        },
        "starttime": "2017-05-01T00:08:00.002Z",
        "endtime": "2017-05-01T00:08:00.003Z"
    }
]

Defining Start Time and Time Range

As described in Requesting Aggregates, the start and end times cannot be defined with higher precision than the time range. For clarification, the following table lists combinations of start time, end time, and interval length and explains the expected response:

Start Time End Time Interval Length Returned Intervals Explanation
14:00:01.000 14:00:01.300 1 ms - Rejected since the response would contain more than 200 intervals.
Interval length available for simulation entities only.
14:00:01.005 14:00:01.015 10 ms - Rejected since start and end time defined with higher precision than interval length.
Interval length available for simulation entities only.
14:00:01.000 14:00:02.000 1 s 1 Interval length available for simulation entities only.
14:00 15:00 2 min 30 Interval length available for performance entities only.
14:00 15:00 4 min 15 Interval length available for performance entities only.
14:00 15:00 1 min 60 Calculated on the fly from raw time series data.
Interval length available for performance entities only.
14:00 15:00 3 min 20 Calculated from pre-calculated intervals and time series data.
Interval length available for performance entities only.
14:01 15:01 2 min 30 Calculated on the fly from raw time series data.
Interval length available for performance entities only.
14:30 16:30 1 h - Rejected - start and end times defined with higher precision than interval length
14:30 16:30 60 min 2 Interval length available for performance entities only.
14:30 16:30 30 min 4 Interval length available for performance entities only.
March 1st, 10:00 March 5th, 10:00 1 d - Rejected - start and end times defined with higher precision than interval length
Interval length available for performance entities only.
March 1st, 10:00 March 5th, 10:00 24 h 4 Interval length available for performance entities only.
March 1st (Wednesday), 00:00 April 1st, 00:00 1 week - Rejected - start and end times defined with higher precision than interval length (assuming weeks start on Monday for this tenant)
Interval length available for performance entities only.
March 1st, 00:00 April 5th, 00:00 7 d 5 Interval length available for performance entities only.
March 1st, 00:00 June 1st, 00:00 1 month 3 Interval length available for performance entities only.
March 1st, 00:00 June 29th, 00:00 30 d 4 Interval length available for performance entities only.

Any questions left?

Ask the community


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