×

Vehicles list

This API retrieves a list of vehicles with their main information, assigned drivers, current tasks, statuses, and additional details.

How to get data

Request address

To get the data, use the address: https://tasks.<server_address>/backend/public/get_vehicles

Request method

GET

Request parameters

  • page — page number for selection (used for table visualization). Default: 1
  • start — offset for selection (used in SQL queries). Default: 0
  • limit — number of records to fetch. Default: 25
  • usr_id — user ID (from the authorization object)
  • acc_id — account ID (from the authorization object)
     

Example request

fetch("https://tasks.<server_address>/backend/public/get_vehicles?_dc=1597911482354&page=1&start=0&limit=10000", {
  method: "GET",
  headers: {
    "accept": "*/*",
    "accept-language": "uk-UA,uk;q=0.9,ru;q=0.8,en-US;q=0.7,en;q=0.6",
    "x-csrf-token": "CtrsOKz3NykfxWlyboPlq3LGNpPrWsCtIymrKq0G"
  },
  credentials: "include"
})
Response
{
  "page": 1,
  "items": [
    {
      "id": 64314,
      "c_vehicle_id": "fgr5b7e657rtg",
      "c_driver_id": 317,
      "c_account_id": 1107,
      "c_status_id": 1,
      "c_information": {
        "id": "fgr5b7e657rtg",
        "agentid": 97405,
        "veh_id": 97405,
        "account_id": 1107,
        "number": "test ds 222",
        "model": "",
        "driver_id": 317,
        "driver_name": "Ivan Ivanov",
        "driver_phone": "798345546",
        "folder": "MAIN",
        "volume": "0.000",
        "disabled": false,
        "info": "",
        "year": "1900",
        "full_capacity": "0",
        "seating_capacity": "0",
        "work_schedule": {
          "schedule": "09:00-18:00",
          "days_of_week": [0,1,2,3,4]
        }
      },
      "c_task_id": 154955,
      "c_ping_ts": 1597735213,
      "c_set_status_time": 1597735213,
      "agent_id": 97405,
      "is_busy": true,
      "c_ass_tasks_id": "154955,155627,155628,155629"
    }
  ],
  "total": 1,
  "msg": []
}
In response to the API request, the following is returned:
  • id — record ID
  • c_vehicle_id — vehicle ID in the system
  • c_driver_id — ID of the assigned driver
  • c_account_id — account ID
  • c_status_id — vehicle status
  • c_information — additional information about the vehicle (model, number, work schedule, etc.)
  • c_task_id — current assigned task for the vehicle
  • c_ping_ts — timestamp of the last connection with the mobile app
  • c_set_status_time — timestamp of the last status update
  • agent_id — agent ID
  • is_busy — vehicle availability flag
  • c_ass_tasks_id — list of assigned task IDs