Returns aggregated results for sensor events for given sensors

Params

Param name Description
sensor_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
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
date_ranges
optional

Array of hashes, each hash should have from and to timestamps for defining date range


Value: Must be an array of any type
field_list
optional

List of fields required in the result.


Value: Must be an array of any type
pretty
optional

Return a pretty formatted response if true, Default is false


Value: Must be a Boolean

Examples

Request data for 2 sensors for a period of 24 hours in Asia/Calcutta time zone.
  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","sensor_keys":["2f3ebc1cfted1956de1d8tat3be5f66ab7ed27ct","e4aa3e35t675fc57ce81f3dd6e2dcdef492at4f7"],"date_ranges":[{"from":"2015/04/03 00:00:00","to":"2015/04/04 00:00:00"}]}' 'https://api.datonis.io/api/v2/datonis_query/sensor_event_data'

Returns a summary result and sensor wise result.
{
  "summary_result": {
    "data.mem": {
      "sum": 117733.0,
      "min": 106.0,
      "max": 521.0,
      "avg": 387.2796052631579
    },
    "data.cpu": {
      "sum": 795.55,
      "min": 1.075,
      "max": 3.875,
      "avg": 2.6169407894736842
    },
    "data.__counters__": {
      "count": 304,
      "idle_time_mins": 2857,
      "total_time_mins": 2880
    }
  },
  "sensor_wise_result": {
    "2f3ebc1cfted1956de1d8tat3be5f66ab7ed27ct": {
      "data.mem": {
        "sum": 0.0,
        "min": null,
        "max": null,
        "avg": 0.0
      },
      "data.cpu": {
        "sum":...
Request data for a sensor 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","sensor_keys":["e4aa3e35t675fc57ce81f3dd6e2dcdef492at4f7"],"date_ranges":[{"from":"2015/04/02 16:00:00","to":"2015/04/02 19:00:00"}]}' 'https://api.datonis.io/api/v2/datonis_query/sensor_event_data'

Returns a summary result, sensor wise result and a hourly time grouped result for the sensor.
{
  "summary_result": {
    "data.mem": {
      "sum": 194417.0,
      "min": 106.0,
      "max": 263.0,
      "avg": 194.6116116116116
    },
    "data.cpu": {
      "sum": 1077.175,
      "min": 0.1,
      "max": 6.574999999999999,
      "avg": 1.0782532532532532
    },
    "data.__counters__": {
      "count": 999,
      "idle_time_mins": 150,
      "total_time_mins": 180
    }
  },
  "sensor_wise_result": {
    "e4aa3e35t675fc57ce81f3dd6e2dcdef492at4f7": {
      "data.mem": {
        "sum": 194417.0,
        "min": 106.0,
        "max": 263.0,
        "avg": 194.6116116116116
      },
     ...
Request data for a sensor 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","sensor_keys":["e4aa3e35t675fc57ce81f3dd6e2dcdef492at4f7"],"date_ranges":[{"from":"2015/04/02 17:05:00","to":"2015/04/02 17:15:00"}]}' 'https://api.datonis.io/api/v2/datonis_query/sensor_event_data'

Returns a summary result, sensor wise result and a hourly time grouped result for the sensor.
{
  "summary_result": {
    "data.mem": {
      "sum": 0.0,
      "min": null,
      "max": null,
      "avg": 0.0
    },
    "data.cpu": {
      "sum": 0.0,
      "min": null,
      "max": null,
      "avg": 0.0
    },
    "data.__counters__": {
      "count": 0,
      "idle_time_mins": 10,
      "total_time_mins": 10
    }
  },
  "sensor_wise_result": {
    "e4aa3e35t675fc57ce81f3dd6e2dcdef492at4f7": {
      "data.mem": {
        "sum": 0.0,
        "min": null,
        "max": null,
        "avg": 0.0
      },
      "data.cpu": {
        "sum": 0.0,
        "min": null,
        "max": null,
  ...
Request data for a sensor for 1 hour for the 'data.cpu' field only.
  curl -X POST -H "Content-Type:application/json" --header 'X-Auth-Token:IEkmVGHsa4R3cGPw56MkfQ' -d '{"idle_time_required":true,"time_zone":"Asia/Kolkata","sensor_keys":["e4aa3e35t675fc57ce81f3dd6e2dcdef492at4f7"],"date_ranges":[{"from":"2015/04/02 16:30:00","to":"2015/04/02 17:30:00"}], "field_list":["data.cpu"]}' 'https://api.datonis.io/api/v2/datonis_query/sensor_event_data'

Returns one hour of aggregated data for 'data.cpu' field
{
  "summary_result": {
    "data.cpu": {
      "sum": 1077.175,
      "min": 0.1,
      "max": 6.574999999999999,
      "avg": 1.0782532532532532
    },
    "data.__counters__": {
      "count": 999,
      "idle_time_mins": 30,
      "total_time_mins": 60
    }
  },
  "sensor_wise_result": {
    "e4aa3e35t675fc57ce81f3dd6e2dcdef492at4f7": {
      "data.cpu": {
        "sum": 1077.175,
        "min": 0.1,
        "max": 6.574999999999999,
        "avg": 1.0782532532532532
      },
      "data.__counters__": {
        "count": 999,
        "idle_time_mins": 30,
        "total_time_mins": 60
     ...