Returns raw event data for a sensor

Params

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

Examples

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
      }
    ]
  }
}