Updating position attributes after creation to get the latest attribute information

jvdsa year ago

Hello,

Would it be possible to update the position attributes of a device, the moment that this position data is loaded inside the Traccar web portal or/and when someone retrieves the position data via the api? The goal of this would be to provide real-time information about certain attributes that may have changed or updated since the last sent position update.

For my current use case, I use the OsmAnd protocol to send position updates for certain devices. However, I do not always have access to the most recent data for some of the custom device attributes at the moment of the position update. Because of this, the position record in the Traccar db contains custom position attributes that are outdated. This is not a problem, unless a user requests and sees this information (through the web portal and/or api). One possible solution is to send an identical position update (same time & position), with updated attributes (without filtering this duplicate out) whenever more recent attribute data is available. However, it would be great if the Traccar instance could instead "ask" an external source for the latest attribute information when the corresponding position data is requested by a client (through the web portal and/or api).

So my question is basically if there is some kind of webhook (e.g. Traccar forwards device data to an url before returning position data, triggering an update of the position attributes), event system (e.g. Traccar sends event when user requests position information, giving external system the opportunity to update the position attributes) or other feature, so that the second method of updating the position attributes can be implemented. Is this possible in some way?

Kind regards

Anton Tananaeva year ago

What you're asking is not possible, but this is the right solution:

One possible solution is to send an identical position update (same time & position), with updated attributes (without filtering this duplicate out) whenever more recent attribute data is available.

In fact, if you don't send location data with OsmAnd, Traccar will automatically reuse the latest location it has.