Schema for the body of a time series query

Love how you guys have tons of docs, but I still have a question.

 "properties": {
    "start": {
      "type": "number"
    },
    "end": {
      "type": "number"
    },
    "duration": {
      "type": "number"
    },
    "resolution": {
      "type": "number"
    },

I have no idea what these mean, do you? Shouldn’t the start and end be datetime? Duration? Resolution? None of this is explained in the docs.

I need to be able to make an API call with a date range and deviceID and get back historical data for Amps, Watts and Volts.

Hi @Jonathan_Betke,

Thanks for your post! Could you point me to where you found this in the docs?

Thanks,
Julia

https://docs.losant.com/rest-api/schemas/#time-series-query

Thank you!

I agree that the documentation here is unclear; I will be updating it in the future. The properties function as follows:

Start: Beginning of range in milliseconds.
End: End of range in milliseconds since Epoch. 0 or blank means current time, and negative values are milliseconds into the past from now. End can also be an Epoch timestamp.
Duration: The duration of time over which to look (when not using start).
Resolution: The time segments over which to perform the data aggregation; groups the data together.

These properties do not all function concurrently. For example, trying to use end, start, and duration together will result in duration being ignored altogether.

For your use case, I would recommend using start, end, and resolution. You will be able to use start and end for your date range, resolution for the length of your aggregation, and can define a deviceID to get your historical data. Here is an example:

Hopefully this helps,
Julia

Helps, but how would say 3 months worth of history data look as far as start and end time? I’m still confused about start and end being in milliseconds.

What is the millisecond equivalent to January 5th, 2019 thru today as it relates to start and end in the JSON?

Never mind, this is Unix Epoch time right? if so, then I’m not confused anymore.

You’re correct. They are milliseconds since epoch.