Geofence visit history

This API retrieves information about when objects (vehicles) entered and exited specific geozones over a specified period.

How to get data

Method

GET

Request address

To get the data, use the address: https://<server_address>/api/api.php?

Request parameters

  • cmd=ag_geozones — API command to get geozone visit history
  • start — start of the period (Unix timestamp)
  • stop — end of the period (Unix timestamp)
  • imei — vehicle identifier(s). Multiple IMEIs can be provided, separated by commas
  • node — node number where the command is executed
 

Example request for a single vehicle

https://<server_address>/api/api.php?cmd=ag_geozones&start=1606770000&stop=1608584399&imei=865291046424635&node=1
Response
{
  "code": 0,
  "msg": "OK",
  "data": [
    {
      "group": "General",
      "zonename": "Golitsyno Base",
      "ts": 1606805707,
      "te": 1606808500
    },
    {
      "group": "General",
      "zonename": "Golitsyno Base",
      "ts": 1606865643,
      "te": 1606868103
    }
  ]
}
 

Example request for multiple vehicles

https://<server_address>/api/api.php?cmd=ag_geozones&start=1606770000&stop=1608584399&imei=865291046424635,867481037184458
Response
{
  "code": 0,
  "msg": "OK",
  "data": {
    "865291046424635": [
      {
        "group": "General",
        "zonename": "Golitsyno Base",
        "ts": 1606805707,
        "te": 1606808500
      },
      {
        "group": "General",
        "zonename": "Golitsyno Base",
        "ts": 1606865643,
        "te": 1606868103
      }
    ],
    "867481037184458": [
      {
        "group": "General",
        "zonename": "Golitsyno Base",
        "ts": 1607949101,
        "te": 1607956478
      },
      {
        "group": "General",
        "zonename": "Golitsyno Base",
        "ts": 1608012176,
        "te": 1608041334
      }
    ]
  }
}
In response to the API request, the following is returned:
  • code — result code (0 = success)
  • msg — server message (e.g., "OK")
  • data — geozone visit information:
  • If single object, data is an array of visits
  • If multiple objects, data is an object where keys are vehicle IMEIs, and values are arrays of visits
  • group — geozone group
  • zonename — name of the geozone
  • ts — entry time into the geozone (Unix timestamp)
  • te — exit time from the geozone (Unix timestamp)