Assigning driver to a device is not the same thing as current driver.
thanks Anton!
I think I don't understand your answer.
What I am trying to do is a previous validation before linking an object with another, for example when assigning a driver.
I have read the API documentation, but I see the two methods (POST, DELETE ) accepted by / permissions; They are to link or unlink objects, not to see which are currently linked.
You can use /api/drivers
endpoint to get list of drivers linked to a particular device.
Ok, i see now.
Using /api/drivers (and passing deviceId as parameter), return an array containing all driver objects linked to this device.
This solve the validation problem for me, I leave this explanation here in case someone else serves.
However, I can see that more than one driver can be associated with one device at a time. As I understand the value of assigning a driver to a device, it is the responsibility assigned to that driver for a given period, which is reflected for example in the reports.
In summary and as a suggestion, it should be possible to assign only one driver at a time.
Anton, thanks again for the quick response.
problem solved for me.
Traccar rocks <3
About your suggestion, please read my original comment. I think you misunderstand what driver assignment means. It means that driver is allowed to drive the car, not that it's currently driving it. So, many drivers are allowed to drive it, but current driver is determined based on position attributes.
Thanks for the explanation, now I understand the original comment. It was definitely a misunderstanding.
Hi again Anton!
I decided to post this question here because I think it is related to the first question.
Is there a way to manually assign the current driver through the API?
Thanks in advance
No.
Hi everyone!
Actually im working on a PWA using Traccar as backend through the API.
I understand that to assign a driver to a device, or link an object to another from the API, I must do it at the following endpoint : POST /permissions
Is there any way to query the currently linked objects? For example to check if the driver being assigned is already assigned to another device.
I´m actually solving this problem, using an attribute in the device object with the uniqueId of the current driver.
Thanks in advance!