Traccar not Forwarding PositionId

mhzatworka year ago

I am using forwarding config in traccar to forward events and positions to another URL.
I have the following config:

    <entry key='event.forward.enable'>true</entry>
    <entry key='event.forward.url'>http://srv-fms:8088/api/tracking/callback/</entry>


    <entry key='forward.enable'>true</entry>
    <entry key='forward.type'>json</entry>
    <entry key='forward.url'>http://localhost:8088/api/callback/</entry>
    <entry key='forward.retry.enable'>true</entry>
    <entry key='forward.retry.delay'>50</entry>

My issue is that it does not forward the correct PositionId it is always 0. But for events it has the correct id.

Are positions sent before being saved to traccar database? so that they don't have valid id.

mhzatworka year ago

Forwarding sample of data:

{
  "position": {
    "id": 0,
    "attributes": {},
    "deviceId": 7,
    "serverTime": "2024-01-02T06:26:29.965+00:00",
    "deviceTime": "2024-01-02T06:26:28.000+00:00",
    "fixTime": "2024-01-02T06:26:28.000+00:00",
    "outdated": false,
    "valid": true
....
  },
  "device": {
    "id": 7
  }
....
}
{
  "event": {
    "id": 16333,
    "attributes": {},
    "deviceId": 7,
    "type": "deviceUnknown",
    "eventTime": "2024-01-02T06:28:32.727+00:00"
  },
  "device": {
    "id": 7,
    "attributes": {}
....
  }
}
Anton Tananaeva year ago

Are positions sent before being saved to traccar database?

Yes.

mhzatworka year ago

Do have any solution for getting position id ?

Anton Tananaeva year ago

If you really need it, you can probably modify the order of handlers in the pipeline.

mhzatworka year ago

All right, Thank you.