Skip to main content

Get Aggregation by Time

POST 

/aggregates/variable/byTime

Time aggregates allows you to question answers like:

  • What is the average value of a variable over a time period?
  • What is maximum value of a variable over blocks of 15 minute?
  • What is the difference between initial and last value of a variable over a week?

Time aggregation APIs are very powerful APIs which allows you to summarize millions of datapoins into aggregated form on demand.

note

Aggregation APIs incur charge based on how much data scanned to compute the output. Measured in GB-Scanned

note

Maximum processing time for each request is 10s

Fields from and to defines a global range from which data is read. This data is then processed as per provided config object. First option defines the type of aggregation you want to perform.

AggregationDescription
sumSums all values over given interval
avgComputes average value over given interval
medianComputes median value over given interval
minComputes minimum value over given interval
maxComputes maximum value over given interval
diffComputes difference between first and last value over given interval. For example: If values are (1,2,3,1,2) the result will be 1
deltasumComputes difference between first and last value over given interval, but accounts for reset in counter between time ranges. For example: If values are (1,2,3,1,2) the result will be 5. i.e the decrease in value is neglected. Useful when your values are ever increasing, like energy or water meters

Along with aggregation one more field forEachNode is specified which controls whether the aggregation should be performed for each individual node specified or values from all nodes should be combined in single output. Note: This feature works only when valid filter object is specified and type is include.

interval object defines the time intervals for aggregation. For example: Specifying aggregation as max, interval type to be minute and interval to be 5 will give maximum value of variable in intervals of 5 minutes for the time range specified in to and from.

filter object allows you to perform aggregation only for a particular set of nodes or excluding particular set of nodes.

Request

Body

    variable stringrequired
    from integerrequired
    to integerrequired
    config objectrequired
    aggregation object
    compute stringrequired

    Possible values: [sum, avg, median, min, max, diff, deltasum, stddev]

    forEachNode boolean
    interval objectrequired
    measure string

    Possible values: [year, month, week, day, hour, minute]

    interval integer
    responseOptions object
    timezone string

    Possible values: [UTC]

    filter object
    nodes string[]
    type string

    Possible values: [include, exclude]

Responses

OK

Schema
    success boolean
    error string
    errorcode integer
    variable string
    config object
    aggregation object
    compute string
    forEachNode boolean
    interval object
    measure string
    interval integer
    filter object
    nodes string[]
    type string
    responseOptions object
    timezone string
    data object
    node1 object[]
  • Array [
  • timestamp integer
    aggregate number
  • ]
Loading...