Pagination
Long time windows are read page by page. Each page tells you where the next one starts.
One response reads at most limit stored records from the window (256 by default). If records are left over, the response includes next_timestamp. Repeat the request with that value and the same other parameters until a response comes back without next_timestamp.
Oldest first (the default)
With ascending=true, next_timestamp is one millisecond after the last record read. Use it as the next start_time and keep end_time as it was.
request 1: start_time=1764547200000 end_time=1764633600000
response: { "data": [...], "next_timestamp": 1764580001235 }
request 2: start_time=1764580001235 end_time=1764633600000
response: { "data": [...] } <- no next_timestamp: done
Newest first
With ascending=false (on data, env and connected), pages walk back in time. Here next_timestamp is one millisecond before the oldest record read, and it becomes the next end_time. Keep start_time as it was.
request 1: start_time=1764547200000 end_time=1764633600000 ascending=false
response: { "data": [...], "next_timestamp": 1764600000999 }
request 2: start_time=1764547200000 end_time=1764600000999 ascending=false
To get only the latest record of a device, ask for a wide window with ascending=false&limit=1.
Things to know
limitcounts stored records, not samples. Onacc,gyrandainone stored record is a packet of many samples, and withmerge=truethe whole page is returned as one item.- On
fftwithmerge=true, packets are joined by UTC hour within each page. An hour that spans two pages can arrive as two items, one in each page. timestamps_only=trueis never paged. It returns every record time in the window at once.- An empty window returns
{"data": []}with nonext_timestamp.