View All Vehicles

3. VIEW ALL VEHICLES

URL: https://app.detrack.com/api/v1/vehicles/view/all.json
HTTP POST REQUEST

Note: the request structure below is for Method #1: Name/Value Pair (NVP) + JSON String. For Method #2: Custom Header + JSON Body, please refer to the json parameter only.

Parameter Description
key Your API key. You can obtain this from your dashboard.
HTTP POST RESPONSE (JSON)
Field Description
info Contains information on the status of the request.

Field Description
status The status of the request. The value will be “ok” if request is processed successfully or “failed” if the key or json parameter is missing.
error Contains the error details if the request failed. Note: this field is set only if the request failed.

Field Description
code The error code. Please refer to Vehicle Error Codes
message The corresponding error message.
vehicles This field may or may not be empty. If not empty, it should contain an array of vehicles with the following fields:

Field Description
name The vehicle name.
detrack_id The Detrack ID tagged to this vehicle.
speed_limit The speed limit set by the user.
stationary_limit The stationary time limit set by the user.
disabled The status of this vehicle. If vehicle is disabled, the value is false, else it is true.
lat The latitude of the current / last known location.
lng The longitude of the current / last known location.
address The address of the current / last known location.
no_gps The GPS status of this vehicle. If vehicle has GPS signal, the value is false, else it is true.
batt Indicates the percentage battery status of the device.
mobile_number The mobile number of the Driver entered under the Vehicles tab.
speed The current speed.
max_speed The maximum speed.
avg_speed The average speed.
distance The distance traveled.
connected_at The time the vehicle is last connected. ISO 8601 format: YYYYMMDDTHH:MM:SS+HH:MM e.g. 2014-02-13T09:30:45+08:00
tracked_at The time the vehicle is last tracked. ISO 8601 format: YYYYMMDDTHH:MM:SS+HH:MM e.g. 2014-02-13T09:30:45+08:00
connection Indicates whether the Driver App is connected to Detrack server. If the vehicle is connected, the value is true, else it is false.
SAMPLE RESPONSE JSON
{
  "info": {
    "status": "ok"
  },
  "vehicles": [
    {
      "name": "Vehicle #1",
      "detrack_id": "5893ade3b3c509",
      "speed_limit": 90,
      "stationary_limit": 30,
      "disabled": false,
      "lat": 1.334898,
      "lng": 103.913319,
      "address": "140 Bedok Reservoir Road",
      "no_gps": false,
      "batt": 96,
      "mobile_number": "",
      "speed": 36,
      "max_speed": 82,
      "avg_speed": 54,
      "distance": 27,
      "connected_at": "2014-05-24T19:14:47.624+08:00",
      "tracked_at": "2014-05-24T19:14:47.624+08:00",
      "connection": "off"
    },
    {
      "name": "Vehicle #2",
      "detrack_id": "5893ade3b3c510",
      "speed_limit": 70,
      "stationary_limit": 30,
      "disabled": false,
      "lat": 1.325126,
      "lng": 103.893957,
      "address": "63 Ubi Avenue 1",
      "no_gps": false,
      "batt": 96,
      "mobile_number": "",
      "speed": 28,
      "max_speed": 67,
      "avg_speed": 44,
      "distance": 36,
      "connected_at": "2014-05-24T19:14:47.624+08:00",
      "tracked_at": "2014-05-24T19:14:47.624+08:00",
      "connection": "off"
    }
  ]
}