Simple question, and I’d take “no” as an answer but would like to be sure: Is there a way to query the Storage Integration with the API to retrieve the LAST data point for a device, such that I don’t have to iterate over various time frames to get the most recent one?
No, you can only limit by timeframe, so if you want data from the last minute, you can add ?last=1m to the URL: https://[your-app-id].data.thethingsnetwork.org/api/v2/query?last=1m
I also would like to get just the last data point, since I have a variable sending interval.
What I’m doing now is to query all the 7 days data and just consider the most recent value, but I think this is a waste of resources, So I would like this new feature.
Ciao
Marco
It may not be easy to do, depending on how TTN has set up their internal database, especially if it’s NoSQL. However, I feel your pain. With just a handful of irregularly sending devices, every time I got to download a few tens of kilobytes to parse and find out if there has been an update.
That’s exactly my issue. I’m using it from a mobile application, so the persistency of the Storage Integration seems better suited than ‘online’ integrations such as MQTT or HTTP.