Returns aggregated results for thing data for given thing keys

Params

Param name Description
thing_keys
optional

Array of sensor_keys


Value: Must be an array of any type
time_grouping
optional

type of time grouping i.e. month/day/hour/minute


Value: Must be a String
time_grouping_value
optional

integer representing value. e.g. if it is 15, and time_grouping is minute, data will be grouped in 15 minute intervals


Value: Must be Integer.
idle_time_required
optional

If idle time is required in the result


Value: Must be one of: <code>true</code>, <code>false</code>.
time_zone
optional

Time zone for calculating data`


Value: Must be a String
from
optional

From Date in format 'yyyy/mm/dd hh:mm:ss'


Value: Must be a String
to
optional

To Date in format 'yyyy/mm/dd hh:mm:ss'


Value: Must be a String
timestamp_format
optional

Format, int or str in which event timestamps should be returned


Value: Must be a String
metrics
optional

List of metric names required in the result.


Value: Must be an array of any type
data_format
optional

Format in which event data should be returned e.g. “array” , “map”


Value: Must be a String
pretty
optional

Return a pretty formatted response if true, Default is false


Value: Must be a Boolean
is_oem
optional

Return thing aggregated data of child thing if is_oem flag is true.


Value: Must be a Boolean
functions
optional

List of functions to be used for aggregation. Valid values are : avg, min, max, sum, count. Note: if avg is selected them and sum and count are also returned


Value: Must be an array of any type

Examples

Request data for a thing for a period of 5 hours in Asia/Calcutta time zone.
  curl -X POST -H "Content-Type:application/json" --header 'X-Auth-Token:IEkmVGHsa4R3cGPw56MkfQ' -d '{"idle_time_required":true,"time_zone":"Asia/Calcutta","thing_keys":["11a6238e445dtd65a45ddfdabd6b8f41dbfetdfd"],"from":"2016/02/01 00:00:00","to":"2016/02/01 05:00:00" }' 'https://api.datonis.io/api/v3/datonis_query/thing_aggregated_data'

Returns a summary result and thing wise result.
{
  "summary_result": {
    "cpu": {
      "count": 498.0,
      "sum": 2028.144,
      "min": 0.046,
      "max": 7.988,
      "avg": 4.072578313253012,
      "idle_time_mins": 42,
      "total_time_mins": 300
    },
    "mem": {
      "count": 498.0,
      "sum": 124426.342,
      "min": 100.369,
      "max": 399.048,
      "avg": 249.85209236947793,
      "idle_time_mins": 42,
      "total_time_mins": 300
    }
  },
  "thing_wise_result": {
    "11a6238e445dtd65a45ddfdabd6b8f41dbfetdfd": {
      "cpu": {
        "count": 498.0,
        "sum": 2028.144,
        "min": 0.046,
        "max":...
Request data for a thing for a period of 3 hours in Asia/Calcutta time zone, grouped into hourly buckets.
  curl -X POST -H "Content-Type:application/json" --header 'X-Auth-Token:IEkmVGHsa4R3cGPw56MkfQ' -d '{"time_grouping":"hour","idle_time_required":true,"time_zone":"Asia/Calcutta","thing_keys":["11a6238e445dtd65a45ddfdabd6b8f41dbfetdfd"],"from":"2016/02/01 10:00:00","to":"2016/02/01 13:00:00" }' 'https://api.datonis.io/api/v3/datonis_query/thing_aggregated_data'

Returns a summary result, thing wise result and a hourly time grouped result for the thing.
{
  "summary_result": {
    "cpu": {
      "count": 634.0,
      "sum": 2532.3750000000005,
      "min": 0.004,
      "max": 7.996,
      "avg": 3.9942823343848586,
      "idle_time_mins": 4,
      "total_time_mins": 180
    },
    "mem": {
      "count": 634.0,
      "sum": 158742.0,
      "min": 100.343,
      "max": 399.703,
      "avg": 250.38170347003154,
      "idle_time_mins": 4,
      "total_time_mins": 180
    }
  },
  "thing_wise_result": {
    "11a6238e445dtd65a45ddfdabd6b8f41dbfetdfd": {
      "cpu": {
        "count": 634.0,
        "sum": 2532.3750000000005,
        "min": 0.004,
 ...
Request data for a thing for 10 minute period in UTC time zone, grouped in minutely buckets.
  curl -X POST -H "Content-Type:application/json" --header 'X-Auth-Token:IEkmVGHsa4R3cGPw56MkfQ' -d '{"time_grouping":"minute","idle_time_required":true,"time_zone":"UTC","thing_keys":["e4aa3e35t675fc57ce81f3dd6e2dcdef492at4f7"],"date_ranges":[{"from":"2015/04/02 17:05:00","to":"2015/04/02 17:15:00"}]}' 'https://api.datonis.io/api/v3/datonis_query/thing_aggregated_data'

Returns a summary result, thing wise result and a minutely  time grouped result for the thing.
{
  "summary_result": {
    "cpu": {
      "count": 32.0,
      "sum": 113.804,
      "min": 0.095,
      "max": 7.894,
      "avg": 3.556375,
      "idle_time_mins": 0,
      "total_time_mins": 10
    },
    "mem": {
      "count": 32.0,
      "sum": 7925.794999999999,
      "min": 107.754,
      "max": 399.647,
      "avg": 247.68109374999997,
      "idle_time_mins": 0,
      "total_time_mins": 10
    }
  },
  "thing_wise_result": {
    "11a6238e445dtd65a45ddfdabd6b8f41dbfetdfd": {
      "cpu": {
        "count": 32.0,
        "sum": 113.804,
        "min": 0.095,
        "max": 7.894,
       ...
Request data for a thing for 1 hour for the 'cpu' field only.
  curl -X POST -H "Content-Type:application/json" --header 'X-Auth-Token:IEkmVGHsa4R3cGPw56MkfQ' -d '{"idle_time_required":true,"time_zone":"Asia/Calcutta","thing_keys":["11a6238e445dtd65a45ddfdabd6b8f41dbfetdfd"],"from":"2016/02/01 10:00:00","to":"2016/02/01 11:00:00", "metrics":["cpu"] }' 'https://api.datonis.io/api/v3/datonis_query/thing_aggregated_data'

Returns one hour of aggregated data for 'cpu' field
{
  "summary_result": {
    "cpu": {
      "count": 35.0,
      "sum": 124.828,
      "min": 0.095,
      "max": 7.894,
      "avg": 3.5665142857142857,
      "idle_time_mins": 0,
      "total_time_mins": 11
    }
  },
  "thing_wise_result": {
    "11a6238e445dtd65a45ddfdabd6b8f41dbfetdfd": {
      "cpu": {
        "count": 35.0,
        "sum": 124.828,
        "min": 0.095,
        "max": 7.894,
        "avg": 3.5665142857142857,
        "idle_time_mins": 0,
        "total_time_mins": 11
      }
    }
  }
}