Assign geofence to device - API

brm7 years ago

Hello, I have a question, using traccar api, how to assign a geofence to device using api?

thank you.

Anton Tananaev7 years ago

I would recommend to check what official web app sends. It uses exactly the same API.

brm7 years ago

Thanks!

Assign geo-fences with API to traccar devices.

  1. Create geo-fences with API
    https://www.traccar.org/api-reference/#path--geofences

  2. Pick Device and assign Geofences.
    https://www.traccar.org/api-reference/#operation--devices-post
    'geofenceIds' as key need to use to assign list of geo-fences.

Create params.

{
    area = "CIRCLE (32.299725 72.021192, 300.000000)";
    attributes =     {
    };
    calendarId = 0;
    description = Ok;
    id = 49;
    name = School Parking;
}

With Python3: use requests lib. make more easier to integrate your solution.

We had already done geo-fences assignment with traccar and build many reports over geofences.

Thanks,
SnippetBucket