Geofence IDs not working

Usman Khan2 years ago

Alright Ill try that

Usman Khan2 years ago

This Api that you mentioned is responding with 404 every time,

But I use

GET /api/geofences?userId=27 

Response:

[
    {
        "id": 51,
        "attributes": {},
        "groupId": 0,
        "name": "RF-V26/1403157819",
        "uniqueId": "1403157819",
        "status": "online",
        "lastUpdate": "2023-03-20T16:41:12.505+00:00",
        "positionId": 56093,
        "geofenceIds": null,
        "phone": null,
        "model": "RF-V26",
        "contact": null,
        "category": "tracker",
        "disabled": false,
        "expirationTime": null
    },
    {
        "id": 72,
        "attributes": {},
        "groupId": 0,
        "name": "RF-V34/1403152593",
        "uniqueId": "1403152593",
        "status": "online",
        "lastUpdate": "2023-03-20T16:38:44.064+00:00",
        "positionId": 56092,
        "geofenceIds": [
            443
        ],
        "phone": null,
        "model": "RF-V34",
        "contact": null,
        "category": "tracker",
        "disabled": false,
        "expirationTime": null
    },
    {
        "id": 73,
        "attributes": {},
        "groupId": 0,
        "name": "RF-V34/1403158197",
        "uniqueId": "1403158197",
        "status": "online",
        "lastUpdate": "2023-03-20T16:43:27.951+00:00",
        "positionId": 56095,
        "geofenceIds": null,
        "phone": null,
        "model": "RF-V34",
        "contact": null,
        "category": "tracker",
        "disabled": false,
        "expirationTime": null
    }
]

here with one device I see a GeofenceId ,This Geofence I already have deleted and I am using the unlinked permission Api to remove this fence id and that is also not working.

Anton Tananaev2 years ago

The response you're shoring is definitely not from that endpoint. Make sure you double check everything before rushing with a comment here.

Usman Khan2 years ago

If I am not wrong
my respond is from the end point .and its from the below url

http://213.109.162.222:8082/api/geofences?userId=27

The response

The traccar server is running on a ubuntu Server.

Anton Tananaev2 years ago

You are definitely wrong. Geofences endpoint will not return device objects.

Usman Khan2 years ago

Yeah I am really sorry my bad ,

its was this Api call

http://213.109.162.222:8082/api/devices?userId=27

But now that Api is not giving that response which you have told me

Usman Khan2 years ago
GET /api/geofences?deviceId=X

this Api is responding 404.

what do I need to do to fix this? and where I am doing mistake that the device are not connecting with the fence ?

Anton Tananaev2 years ago

You're doing something wrong again. It should never return 404.

Anton Tananaev2 years ago

If there are no geofences, it will return empty, but not 404.

Can you please going forward provide proof of the request and response, so we can verify that you're doing the things you're saying you're doing.

Usman Khan2 years ago

Actually I am stressed out due to this project so I do these silly mistakes , But anyways the response is 200 this time

and I find out that those devices were connected to the fence to which I was trying to connect them

But then I have Question Why the geofenceIds are not getting updated in the device object,

I guess that attribute is also responsible to tell and show to which fence id it is connected , or not ?

Anton Tananaev2 years ago

I guess that attribute is also responsible to tell and show to which fence id it is connected , or not ?

It's not and I already explained twice in this thread what the field is for. Please take your time and carefully read my comments again.