Geofence Creation API

ginppian 8 years ago

Why @QueryIgnore, excuse me:

traccar/src/org/traccar/model/Device.java
 @QueryIgnore
    public long getPositionId() {
        return positionId;
    }

    public void setPositionId(long positionId) {
        this.positionId = positionId;
    }

    private long groupId;

    public long getGroupId() {
        return groupId;
    }

    public void setGroupId(long groupId) {
        this.groupId = groupId;
    }

    private List<Long> geofenceIds;
Anton Tananaev 8 years ago

You are using wrong API to link geofences. Please read official API documentation.

ginppian 8 years ago

In official API documentation:

Permission: object

DESCRIPTION
This is a permission map that contain two object indexes. It is used to link/unlink objects. Order is important. Example: { deviceId:8, geofenceId: 16 }

PROPERTIES
userId: integer
User Id, can be only first parameter

deviceId: integer
Device Id, can be first parameter or second only in combination with userId

groupId: integer
Group Id, can be first parameter or second only in combination with userId

geofenceId: integer
Geofence Id, can be second parameter only

calendarId: integer
Geofence Id, can be second parameter only and only in combination with userId

attributeId: integer
Computed Attribute Id, can be second parameter only

driverId: integer
Driver Id, can be second parameter only

managedUserId: integer
User Id, can be second parameter only and only in combination with userId

my post:

https://github.com/ginppian/borrar/blob/master/post.png

my db:

https://github.com/ginppian/borrar/blob/master/geofences.png
https://github.com/ginppian/borrar/blob/master/devices.png

what am i doing wrong ?

Anton Tananaev 8 years ago

From what I can see your deviceId is 4.

ginppian 8 years ago
Anton Tananaev 8 years ago

What version of Traccar are you using?

ginppian 8 years ago

3.13

Anton Tananaev 8 years ago

You have upgrade if you want to use latest API.

ginppian 8 years ago

I installed the new version (3.14) and I cann't:

  • Body and Headers:
https://github.com/ginppian/borrar/blob/master/nv-body.png
https://github.com/ginppian/borrar/blob/master/nv-headers.png
  • DB:
https://github.com/ginppian/borrar/blob/master/nv-devices.png
https://github.com/ginppian/borrar/blob/master/nv-geofences.png
https://github.com/ginppian/borrar/blob/master/nv-device_geofence.png
  • VPS:
https://github.com/ginppian/borrar/blob/master/nv-vps.png
Anton Tananaev 8 years ago

Please read documentation more careful!!! The endpoint is /api/permissions, not /api/permission.

ginppian 8 years ago

Excuse me bro i'm a little fool. I share the process for somebody else:

  • For test is a good idea use Postman
  • We add in "Postman" a "Basic Auth". Isn't neecesary put an admin user, we put our basic user.
https://github.com/ginppian/borrar/blob/master/r-auth.png
  • We add our headers: Accept, Content-Type with application/json, for Authorization, Postman autocomplete.
https://github.com/ginppian/borrar/blob/master/r-header.png
  • For method POST, DELETE, PUT (update), we'd put a body, so in the body:
{
"id": 1,
"name": "Agenda",
"description": "Es una prueba de la agenda",
"area": "CIRCLE (19.045129480045105 -98.23004848937367, 163.6)",
"calendarId": 0
}

we don't write attributes because we want to send these like NULL.

https://github.com/ginppian/borrar/blob/master/r-api.png
https://github.com/ginppian/borrar/blob/master/r-body.png

A basic tuto:

ginppian 8 years ago

Bro AT&T modify Traccar and put it as their property, they are selling your plataform and your app in México

Anton Tananaev 8 years ago

Proof?