How to extract trips from device messages?

we are getting data with https://flespi.io/gw/devices/XXXXXX/messages but we not getting the data from
https://flespi.io/gw/devices/XXXX/intervals particular devices data.
we using this following parameters to get intervals {
"from": uint32,
"to": uint32,
"extend": boolean,
}

we also tried with aslo https://flespi.io/calcs/XXXXX/devices/XXXX/calculate but there showing 404 error

Please help me to how to get intervals data using rest api

Note :

  1. XXXX means selectors and we use flespi device code here
    • Edited

    If you already assign calculator to device - you can get all calculated intervals using get request:

    https://flespi.io/docs/#/gw/!/calculators/get_calcs_calcs_selector_devices_calc_devices_selector_intervals_calc_device_intervals_selector

    But interval - is just begin and end time of messages that satisfy selector conditions. Also you can add fields (counters) in calc to calculate some additional data of interval.
    You can add counter with type "route" to get google polyline string for example

    yeah we get intervals data but we want to get data for particular time period lime 25/09/2019 00:00:00 to 25/09/2019 23:59:59?

    here we are using this from to selectors parameter there showing following error.
    {
    "errors": [
    {
    "code": 2,
    "reason": "#/selectors[0]: value does not match to any of the required schemas"
    }
    ],
    "result": []
    }

    where i can see this selectors values?

      JayantWexoz

      What data do you need?
      Intervals or messages by intervals?

      If you want to get intervals for a specified period, you should send begin/end parameters with unix timestamp:

      curl -X GET --header 'Accept: application/json' --header 'Authorization: FlespiToken YourToken' 'https://flespi.io/gw/calcs/all/devices/all/intervals/all?data=%7B%22begin%22%3A1568677065%2C%22end%22%3A1568718934%7D'

      To get messages for the interval you should:

      1) get intervals (https://flespi.io/docs/#/gw/!/calculators/get_calcs_calcs_selector_devices_calc_devices_selector_intervals_calc_device_intervals_selector)
      2) get begin and end fields from interval
      3) request messages with "from" (interval begin field) and "to" (interval end field) parameters
      (https://flespi.io/docs/#/gw/!/devices/get_devices_dev_selector_messages)

      curl -X GET --header 'Accept: application/json' --header 'Authorization: FlespiToken YourToken' 'https://flespi.io/gw/devices/all/messages?data=%7B%22count%22%3A10000000%2C%22from%22%3A1568677065%2C%22method%22%3A%22average%22%2C%22to%22%3A1568718934%7D'
        • Edited

        You can specify that the calculator should only calculate intervals for a certain period. To do this, you must assign the device to the calculator with the parameters time_begin / time_end. (time should be in unix timestamp format)
        https://flespi.io/docs/#/gw/!/calculators/post_calcs_calcs_selector_devices_calc_devices_selector.

        Three types of selectors described in /calcs POST request. https://flespi.io/docs/#/gw/!/calculators/post_calcs
        Also you can read more about calculator selectors here: https://flespi.com/kb/intervals-selectors-build-intervals-from-messages

          Also you can calculate intervals on the fly without assigning device to calculator. For this you should perform calculate request with calc_id and begin/end params

            Write a Reply...