VIEW VEHICLES
URL: |
|
Limit: | 100 vehicles per request (send separate requests if you are viewing more than 100 vehicles) |
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. |
json | The JSON string containing the vehicles you wish to view. It should contain an array with the vehicle names. |
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. |
failed | The number of vehicles that are not retrieved due to error. |
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. |
results
Contains an array of statuses with the following fields:
Field | Description |
name | The name of the vehicle. |
status | The status of the vehicle view request. The value will be “ok” if the vehicle is successfully retrieved or “failed” if the vehicle is not retrieved. |
vehicle | The retrieved vehicle 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 battery level of the device. |
mobile_number | The mobile number of the Driver as per registerd 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 to our Detrack servers. ISO 8601 format: YYYY–MM–DDTHH: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: YYYY–MM–DDTHH:MM:SS+HH:MM e.g. 2014-02-13T09:30:45+08:00 |
connection | Indicates whether is the Driver App connected to our Detrack servers. If it is connected, the value is on, else off. |
errors
Contains an array of error messages if the vehicle view request failed. Note: this field is set only if the vehicle view request failed.
Field | Description |
code | The error code. Please refer to Vehicle Error Codes |
message | The corresponding error message. |
SAMPLE REQUEST JSON
[ "Vehicle #1", "Vehicle #3" ]
SAMPLE RESPONSE JSON
{
"info":{
"status":"ok",
"failed":1
},
"results":[
{
"name":"Vehicle #1",
"status":"ok",
"vehicle":{
"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": 100,
"mobile_number": "",
"speed":36,
"max_speed":82,
"avg_speed":54,
"distance":27,
"connected_at": "2014-05-24T11:41:59+08:00",
"tracked_at":"2014-05-24T11:41:59+08:00",
"connection": "off"
}
},
{
"name":"Vehicle #3",
"status":"failed",
"errors":[
{
"code":1003,
"message":"Vehicle with name Vehicle #3 not found."
}
]
}
]
}