I don't quite understand the purpose of this API. We already have an async API to get latest data for all devices for the current user.
Can you please provide more details on the use case.
Sorry, I'll try to explain better what I have done.
What I am trying to achieve is to have a map which displays all the devices (or an arbitrary subgroup, since there might be a lot) of a user in their latest known location. The idea is that the user wants to monitor, from time to time, where the devices are to control and maybe to take further actions.
I have checked a bit the async servlet, and I think the response is quite similar of what I am doing. The main difference is that it always returns all devices. Sometimes it would be nice to fetch only a subgroup of devices when the user has many of them.
The one strange thing that it is happening to me is that a call to the async API takes between 20 seconds and 2 minutes, and sometimes, sporadically, it returns an empty data (the next call returns the correct data). Considering that I am trying it in localhost with no devices connected, it seems that I might have some problem. What could that be?
Also the AsyncServlet.handle method is getting called even after all the request has been terminated. It seems to be getting called automatically but without a user, as it always throws that error, and retries a bit later. Perhaps this is due to a request to api/async without being logged in.
OK, it makes sense to have a call to retrieve a subset. The only concern I have about the code, is the way you pass the list of devices. I think it should be just a POST parameter with and array in it instead of full model class for the request, similar to "get" position request.
Agreed. I changed the way the device list goes to the service as you requested and removed all the code that was no longer needed. Now it is a tiny addition but hopefully useful :) And sent you a pull request.
Thanks for all Anton!
Thanks. I have merged your pull request.
Hello Anton,
I am creating a hybrid application. For sending data to server i am using
"http://192.168.0.6:5055/?id=861691032445158&lat=18.4910265&lon=74.00000" this API.
Now i want to get latest data(latitude, longitude,id, route etc..) of device/devices connected to traccar server.
Can u help me which API i can use to get this?
You can find API documentation here:
Hi Anton,
I was implementing a feature to display a subgroup of devices from a given user all at once in a map. The idea is to have a look at where are in the present all the devices (just the latest position).
So, I created a little service (position/devices) in traccar that can retrieve all positions for a list of devices (it is implemented in this branch).
Do you think it could be something useful for traccar (if you call, a pull request goes soon :) )? Is there another way to implement it without modifying traccar?
Thanks in advance!