As there is at the moment no way to get hooked up through a webhook/notifications regarding new balena devices popping up, I went with the route in polling device date via the balena cloud api.
What I’m currently doing is something like this:
v6/device?$orderby=created_at asc&$filter=created_at gt datetime'2021-06-18T13:41:59.251Z'
What I’m essentially trying to do is to get latest
created_at devices and saving it the newest
created_at for another go and I’m expected to find newer devices after I use the latest
created_at and showing either newer devices or no devices at all. Essentially I would expect to get no results if there are no new devices.
However the issue that I’m having is that by using the logical operator
gt I would expect to find newer date, but what I’m ended having is seeing the latest device always (because it matches the same
created_at as my latest device.
TL;DR: I think the
gt is not working as expected, but working as a
ge since I’m seeing the same data over and over again.