Traccar webhook json

Leovigildo Manuel 9 hours ago

Hi everyone, I'm developing an application that will receive traccar webhooks via data forwarding, I want to receive position forwarding
and Event Forwarding.
I didn't find the json models, that is, what format and example of the json that my API will receive. I want to set up a mock to test and validate on my server while I haven't installed the GPS devices yet.
Searching Gemini, I received this json model for position

{
  "position": {
    "id": 12345,
    "attributes": {
      "batteryLevel": 85,
      "distance": 15.4,
      "totalDistance": 12500.5,
      "motion": true
    },
    "deviceId": 10,
    "protocol": "osmand",
    "serverTime": "2024-05-20T14:30:00.000+00:00",
    "deviceTime": "2024-05-20T14:29:55.000+00:00",
    "fixTime": "2024-05-20T14:29:55.000+00:00",
    "outdated": false,
    "valid": true,
    "latitude": -23.55052,
    "longitude": -46.633308,
    "altitude": 760.0,
    "speed": 13.5,
    "course": 180.0,
    "address": "Av. Paulista, São Paulo, SP",
    "accuracy": 0.0,
    "network": null
  },
  "device": {
    "id": 10,
    "name": "Company Car 01",
    "uniqueId": "123456789012345",
    "status": "online",
    "lastUpdate": "2024-05-20T14:30:00.000+00:00",
    "positionId": 12345,
    "groupId": 2,
    "phone": "5511999999999",
    "model": "GT06",
    "contact": "John",
    "category": "car",
    "disabled": false
  }
}
and this one for event
{
  "event": {
    "id": 500,
    "attributes": {},
    "deviceId": 10,
    "type": "deviceOnline",
    "serverTime": "2024-05-20T14:35:00.000+00:00",
    "positionId": 12346,
    "geofenceId": 0,
    "maintenanceId": 0
  },
  "position": {
    "id": 12346,
    "attributes": { "ignition": true },
    "deviceId": 10,
    "latitude": -23.55052,
    "longitude": -46.633308,
    "speed": 0.0
  },
  "device": {
    "id": 10,
    "uniqueId": "123456789012345",
    "name": "Company Car 01"
  }
}

I don't know if this is right. and also, there are several types of events that my API will receive and I would like to know them all.
Does anyone have a complete list of all events and positions that are sent by traccar via webhook?
thank you in advance

Anton Tananaev 8 hours ago

You should check the source code. You can also check the API documentation. Models like events and positions should match with API.

Leovigildo Manuel 7 hours ago

I analyzed the documentation, but nowhere did I find an explanation of the models or json format that is sent, I believe there should be at least one example with mocadso data to know exactly what is sent to the external API by traccar

johng a few seconds ago

Following on from the question in this post, is there a document that shows all the JSON schemas? Also a data dictionary of the datatable fields?