It's not wrong. From devices endpoint you only get geofences that the device is currently in, not all linked ones.
So all geofences created automatically are linked with all devices and geofenceIds in the Device body only shows geofences the device is in. If the device is out of the area then it won't be shown. right?
You still need to link geofences to devices.
Can you please help me in how to do that via the Rest API. Which endpoint should do this linking?
Check how the official web app does it.
Sorry for all this. But I would like to use the APIs directly. am not aware of how to check the logic the web app uses
My devices list. device id 3
Geofences list with device id 3 query
Does this show they are linked with this device?
Hi Anton Tananaev,
I am also facing similar issue:
The update api Response shows that the device is updated with the geofence id
You cannot do this. The geofence id is simply ignored on the update.
Yes Anton Tananaev,
You are right.
Can u please guide me through why is it ignoring the geofenceid . and how can we fix that ?
Because it's a field that Traccar updates. You cannot update it manually. Why would you want to update it yourself?
So, We have this project with some features and it's really crucial for us to update the geofence id in order to connect like 1000 devices at the same time with the geofence, and changing it in future as well, because doing it manually one by one will take long time.
I feel like you are working based off a wrong assumption. You don't need to change that field to link geofences to devices. You only need to do the permission linking.
you mean only permission linking can connect the device to the geofence, without updating the geofenceId field in the Device object.
Yes. Not just can, but that's the only way it should work.
Also, speaking about 1000 devices, you should probably use groups if you need to link each geofence to so many devices. Link it to a group instead.
Am using the devices endpoint to get the list of devices but the geofenceIds is empty which is wrong because I have created geofences and associated them with this device. From the web admin, the devices geofence are shown correctly, also the geofence endpoint with the device filter shows this device has geofences associated with it. What could be the issue causing the geofenceIds to be empty on the devices API but show correctly on web and geofences endpoint?