Traccar not Forwarding PositionId

mhzatwork2 years 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.

mhzatwork2 years 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 Tananaev2 years ago

Are positions sent before being saved to traccar database?

Yes.

mhzatwork2 years ago

Do have any solution for getting position id ?

Anton Tananaev2 years ago

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

mhzatwork2 years ago

All right, Thank you.

JCardus16 days ago

I also need this. I will open a PR.

Anton Tananaev16 days ago

I don't think we have a plan to merge something like this in the official version. You should discuss it first before creating a PR.