Returns aggregated results for sensor events for given sensors
| 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 |
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
...
Returns raw event data for a sensor
| Param name | Description |
|---|---|
|
sensor_key optional |
Sensor key 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 |
|
page optional |
Page number of results to be fetched Value: Must be Integer. |
|
per optional |
Number of records to be returnes in one page Value: Must be Integer. |
|
time_format optional |
Format, int or str in which event timestamps should be returned Value: Must be a String |
|
time_zone optional |
time zone in which to return data e.g. “Mumbai”, “EST” etc Value: Must be a String |
|
order optional |
Order of time_stamp, asc or desc, in which events will be filtered Value: Must be a String |
|
expr optional |
Expression based on which data should be filtered Value: Must be a String |
|
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 |
Request raw data for a sensor for a period of 5 minutes in time zone Mumbai with 50 events per page.
curl -X POST -H "Content-Type:application/json" --header 'X-Auth-Token:IEkmVGHsa4R3cGPw56MkfQ' -d '{"sensor_key":"e4aa3e35t675fc57ce81f3dd6e2dcdef492at4f7", "date_ranges":[{"from":"2015/04/02 17:05:00", "to":"2015/04/02 17:10:00"}], "time_zone":"Mumbai" , "time_format":"str", "per":"50"}' 'https://api.datonis.io/api/v2/datonis_query/sensor_event_raw_data
Returns upto 50 events.
{
"e4aa3e35t675fc57ce81f3dd6e2dcdef492at4f7": {
"total_event_count": 30,
"page_number": 1,
"event_data": [
{
"data": {
"mem": 208,
"cpu": 1.3250000000000002
},
"time_stamp": "2015/04/02 17:09:59"
},
{
"data": {
"mem": 219,
"cpu": 1.45
},
"time_stamp": "2015/04/02 17:09:57"
},
{
"data": {
"mem": 214,
"cpu": 1.45
},
"time_stamp": "2015/04/02 17:09:55"
},
{
"data": {
"mem": 220,
"cpu":...
Request page no 2 of raw data for a sensor for a period of 5 minutes in time zone Mumbai with 10 events per page.
curl -X POST -H "Content-Type:application/json" --header 'X-Auth-Token:IEkmVGHsa4R3cGPw56MkfQ' -d '{"sensor_key":"e4aa3e35t675fc57ce81f3dd6e2dcdef492at4f7", "date_ranges":[{"from":"2015/04/02 17:05:00", "to":"2015/04/02 17:10:00"}], "time_zone":"Mumbai" , "time_format":"str", "per":"10", "page":"2"}' 'https://api.datonis.io/api/v2/datonis_query/sensor_event_raw_data'
Return data for page no 2.
{
"e4aa3e35t675fc57ce81f3dd6e2dcdef492at4f7": {
"total_event_count": 30,
"page_number": "2",
"event_data": [
{
"data": {
"mem": 229,
"cpu": 1.6
},
"time_stamp": "2015/04/02 17:09:38"
},
{
"data": {
"mem": 226,
"cpu": 1.4749999999999999
},
"time_stamp": "2015/04/02 17:09:32"
},
{
"data": {
"mem": 218,
"cpu": 1.4749999999999999
},
"time_stamp": "2015/04/02 17:09:30"
},
{
"data": {
"mem": 218,
...
Request raw data where time is returned in integer format (seconds after epoch)
curl -X POST -H "Content-Type:application/json" --header 'X-Auth-Token:IEkmVGHsa4R3cGPw56MkfQ' -d '{"sensor_key":"e4aa3e35t675fc57ce81f3dd6e2dcdef492at4f7", "date_ranges":[{"from":"2015/04/02 17:05:00", "to":"2015/04/02 17:10:00"}], "time_zone":"Mumbai" , "time_format":"int", "per":"10", "page":"1"}' 'https://api.datonis.io/api/v2/datonis_query/sensor_event_raw_data'
Returns data with timestamps in integer form.
{
"e4aa3e35t675fc57ce81f3dd6e2dcdef492at4f7": {
"total_event_count": 30,
"page_number": "1",
"event_data": [
{
"data": {
"mem": 208,
"cpu": 1.3250000000000002
},
"time_stamp": 1427974799
},
{
"data": {
"mem": 219,
"cpu": 1.45
},
"time_stamp": 1427974797
},
{
"data": {
"mem": 214,
"cpu": 1.45
},
"time_stamp": 1427974795
},
{
"data": {
"mem": 220,
"cpu": 1.45
},
...
Request raw data only for 'data.cpu' field.
curl -X POST -H "Content-Type:application/json" --header 'X-Auth-Token:IEkmVGHsa4R3cGPw56MkfQ' -d '{"sensor_key":"e4aa3e35t675fc57ce81f3dd6e2dcdef492at4f7", "date_ranges":[{"from":"2015/04/02 17:05:00", "to":"2015/04/02 17:10:00"}], "time_zone":"Mumbai" , "time_format":"int", "per":"10", "page":"1", "field_list":["data.cpu"]}' 'https://api.datonis.io/api/v2/datonis_query/sensor_event_raw_data'
Return data with only the required fields.
{
"e4aa3e35t675fc57ce81f3dd6e2dcdef492at4f7": {
"total_event_count": 30,
"page_number": "1",
"event_data": [
{
"data": {
"cpu": 1.3250000000000002
},
"time_stamp": 1427974799
},
{
"data": {
"cpu": 1.45
},
"time_stamp": 1427974797
},
{
"data": {
"cpu": 1.45
},
"time_stamp": 1427974795
},
{
"data": {
"cpu": 1.45
},
"time_stamp": 1427974794
},
{
"data": {
"cpu": 1.35
},
...
Request raw data using filter expression (where 'data.cpu' is greater than 1.5).
curl -X POST -H "Content-Type:application/json" --header 'X-Auth-Token:IEkmVGHsa4R3cGPw56MkfQ' -d '{"sensor_key":"e4aa3e35t675fc57ce81f3dd6e2dcdef492at4f7", "date_ranges":[{"from":"2015/04/02 17:05:00", "to":"2015/04/02 17:10:00"}], "time_zone":"Mumbai" , "time_format":"int", "per":"10", "page":"1", "field_list":["data.cpu"], "expr":"data.cpu > 1.5"}' 'https://api.datonis.io/api/v2/datonis_query/sensor_event_raw_data'
Return raw data after applying filter expression.
{
"e4aa3e35t675fc57ce81f3dd6e2dcdef492at4f7": {
"total_event_count": 3,
"page_number": "1",
"event_data": [
{
"data": {
"cpu": 1.6
},
"time_stamp": 1427974781
},
{
"data": {
"cpu": 1.6
},
"time_stamp": 1427974780
},
{
"data": {
"cpu": 1.6
},
"time_stamp": 1427974778
}
]
}
}