Time series data - latest points


Is there a way to get the most recent points when the limit value is set in a request to the /applications/{applicationId}/data/time-series-query endpoint? An example of the API call I’m making is:

	"deviceIds": [
	"attributes": [
    "end": 0,
	"duration": 262800000,
	"limit": 100

If the device has >100 location readings over the time range, only the earliest 100 points are being returned. The result I’m hoping to achieve is to have up to 3 days of the most recent location history, but limit the max number of points for performance reasons.


Hmm, unfortunately, I don’t think that is possible with the current API endpoint, because we don’t expose a sort direction parameter - it is always in order from oldest to newest. We would need to expose the ability to reverse the order, to list the points from newest to oldest. This is a great request, I’ll file a ticket to expose that option.


Thanks Michael. I’ve overlooked things before so I wasn’t sure if I was missing something. I should be able to work around this by using a Function node and deleting all but the 100 latest data points. I was hitting the max endpoint reply size in some rare cases which is what prompted me to look into the limit parameter in the first place. A sort parameter or some kind of pagination would definitely be helpful though for the time series data in the future.