Unit
A Unit corresponds to a GPS device, which may be installed on various types of machines, vehicles or other forms of hardware. Such a GPS device is typically identified by it's unique serial number, which also denotes the model version.
URL Structure is:
https://api.trackunit.com/public/Unit
GetUnit
Will list parameters on specific unit.
Parameters
Name | Data type | Unit of measurement | Note |
---|---|---|---|
id * | String | N/A | If supplied, we return only that unit. If not, we return all units (taking into account other parameters). |
serialNumber | String | N/A | |
referenceNumber | String | N/A | If supplied, we only return units that belong to a specified reference number. |
categoryId | String | N/A | If supplied, we only return units that belong to a specified category. |
clientId | String | N/A | If supplied, we only return units that belong to a specified client. |
groupId | String | N/A | If supplied, we only return units that belong to a specified group. |
zoneId | String | N/A | If supplied, we return only units currently located inside a specified zone. |
pointId | String | N/A | If supplied, we return only units currently located close to a specified point. If this is supplied, the user may also supply a radius to search within. |
point | Location | Decimal degrees. Latitude = [-90, 90], Longitude = [-180, 180]. | Same as with PointId. Specify location by use of a Lat/Lon. |
radius | double | km | Radius to search within. Default value is 1 kilometer. Valid value is > 0 and < 40000 km. |
Errors
Error Code | Description |
---|---|
unitNotFound | Unit with supplied “Id” was not found. |
categoryNotFound | Category with supplied “CategoryId” was not found. |
clientNotFound | Client with supplied “ClientId” was not found. |
groupNotFound | Group with supplied “GroupId” was not found. |
zoneNotFound | Zone with supplied “ZoneId” was not found. |
pointNotFound | Point with supplied “PointId” was not found. |
Columns
Refer to the following table for description of parameters:
Name | Data type | Unit of measurement | Nullability | Note |
---|---|---|---|---|
id | String | N/A | FALSE | Unique identifier. |
serialNumber | String | N/A | FALSE | Unit GSM number. |
phoneNumber | String | N/A | TRUE | |
vehicleType | String | N/A | FALSE | |
deviceType | String | N/A | FALSE | The model of the unit. |
deviceModel | String | N/A | FALSE | The model of the unit |
name | String | N/A | FALSE | |
displayName | String | N/A | FALSE | The full display name with category name prefixed. |
referenceNumber | String | N/A | TRUE | |
note | String | N/A | TRUE | |
createdAt | DateTime | N/A | TRUE | Time of creation. |
input1Name | String | N/A | TRUE | |
input2Name | String | N/A | TRUE | |
input3Name | String | N/A | TRUE | |
input4Name | String | N/A | TRUE | |
categoryId | String | N/A | TRUE | |
clientId | String | N/A | TRUE | |
keyId | String | N/A | NULL If unit never reported it or there is no driver logged in. | |
gpsFixTime | DateTime | UTC time | NULL If unit never reported valid GPS fix. | |
messageTime | DateTime | UTC time | NULL If unit never reported at all. | |
location | Location | N/A | TRUE | |
altitude | Double | km | TRUE | Above sea level. |
heading | Int | Degrees | TRUE | 0 to 359 degrees. 0 means straight north direction, 90 - straight east etc. |
speed | Double | km/h | TRUE | Current speed. |
address | Address | N/A | TRUE | |
temperature1 | Double | Celcius degrees | TRUE | Temperature sensor 1 value. |
temperature2 | Double | Celcius degrees | TRUE | Temperature sensor 2 value. |
gsmLevel | Double | N/A | TRUE | GSM signal level. |
gsmSignalQuality | String | N/A | TRUE | GSM signal quality, i.e. “Good” / “Bad”. |
gpsSignalQuality | String | N/A | TRUE | GPS signal quality, i.e. “Good” / “Bad”. |
batteryLevel | Double | Percent | TRUE | Internal battery level. |
externalPower | Double | Volt | TRUE | External power voltage. |
preRun1 | Double | Seconds | FALSE | Fixed value to append to hour meter on input 1. |
preRun2 | Double | Seconds | TRUE | Fixed value to append to hour meter on input 2. |
run1 | Double | Seconds | TRUE | Hour meter to Input 1. |
run2 | Double | Seconds | TRUE | Hour meter to Input 2. |
run3 | Double | Seconds | TRUE | Hour meter to Input 3. |
run4 | Double | Seconds | TRUE | Hour meter to Input 4. |
runOdo | Double | Seconds | FALSE | Hou rmeter for driving. |
preKm | Double | Km | FALSE | Fixed value to append to Km. |
km | Double | Km | TRUE | Total km driven. |
input1 | Bool | N/A | TRUE | Status of input 1. |
input2 | Bool | N/A | TRUE | Status of input 2. |
input3 | Bool | N/A | TRUE | Status of input 3. |
input4 | Bool | N/A | TRUE | Status of input 4. |
input5 | Bool | N/A | TRUE | Status of input 5. |
input6 | Bool | N/A | TRUE | Status of input 6. |
input7 | Bool | N/A | TRUE | Status of input 7. |
input8 | Bool | N/A | TRUE | Status of input 8. |
input9 | Bool | N/A | TRUE | Status of input 9. |
input10 | Bool | N/A | TRUE | Status of input 10. |
output1 | Bool | N/A | TRUE | Status of output 1. |
output2 | Bool | N/A | TRUE | Status of output 2. |
output3 | Bool | N/A | TRUE | Status of output 3. |
output4 | Bool | N/A | TRUE | Status of output 4. |
output5 | Bool | N/A | TRUE | Status of output 5. |
analogInput1 | Double | Volt | TRUE | Voltage on analog input 1. |
analogInput2 | Double | Volt | TRUE | Voltage on analog input 2. |
analogInput4 | Double | Volt | TRUE | Voltage on analog input 4. |
input1ChangeCounter | Int | N/A | TRUE | Number of input cycles on input 1. |
input2ChangeCounter | Int | N/A | TRUE | Number of input cycles on input 2. |
input3ChangeCounter | Int | N/A | TRUE | Number of input cycles on input 3. |
input4ChangeCounter | Int | N/A | TRUE | Number of input cycles on input 4. |
isActive | Bool | N/A | FALSE | Indicates whether unit is active or inactive. |
isOwn | Bool | N/A | TRUE | Indicates whether the unit is owned by customer using the API, or not. |
currentStop | Double | Seconds | TRUE | Current stop time in seconds. |
Important
Not all of the above parameters are available for all unit types.
Request (example)
{
"id": "39670"
}
Response
{
"list":[
{
"id": "39670",
"serialNumber": "216990",
"phoneNumber": "4511794299",
"name": "Petra Wollerslev",
"displayName": "CADDY Petra Wollerslev",
"referenceNumber": "1100",
"note": "",
"createdAt": "2011-07-11T10:33:21.9670000Z",
"input1Name": "Power outlet",
"input2Name": "Ignition",
"input3Name": "Input 3",
"input4Name": "Input 4",
"categoryId": "30559",
"gpsFixTime": "2013-08-26T08:58:40.0000000",
"messageTime": "2013-08-26T08:58:40.0000000",
"location": {
"latitude": 56.0800566666667,
"longitude": 12.537155
},
"altitude": 0,
"heading": 35,
"speed": 0,
"address": {
"country": "DK",
"zipCode": "3140",
"city": "Ålsgårde",
"streetAddress": "Nordre Strandvej 227"
},
"gsmLevel": 100,
"gpsSignalQuality": "Good",
"batteryLevel": 90,
"externalPower": 12.747,
"preRun1": 0,
"preRun2": 0,
"run1": 0,
"run2": 2443680,
"run3": 0,
"run4": 0,
"runOdo": 2185980,
"preKm": 0,
"km": 29087,
"input1": false,
"input2": false,
"input3": false,
"input4": false,
"input5": false,
"input6": true,
"input7": false,
"input8": false,
"input9": false,
"input10": false,
"output1": false,
"output2": true,
"output3": false,
"output4": true,
"output5": false,
"isActive": true,
"isOwn": true
}
]
}
UpdateUnit
Will update parameters on any of the existing units.
Parameters
Name | Data type | Unit of measurement | Description |
---|---|---|---|
id * | String | Id of unit to update. | |
name | String | Name of unit. | |
referenceNumber | String | Specify empty string to clear current value. | |
vehicleType | String | Unit type, either car , machine or boat | |
clientId | String | Id of new client. Specify empty string to clear current value. | |
preKm | Double | Kilometers | |
preRun1 | Double | Seconds | |
preRun2 | Double | Seconds | |
note | String | Specify empty string to clear current value. | |
isActive | Bool | ||
input1Name | String | Specify empty string to clear current value. | |
input2Name | String | Specify empty string to clear current value. | |
input3Name | String | Specify empty string to clear current value. | |
input4Name | String | Specify empty string to clear current value. | |
lock | Bool | Lock of unit. Specify true for lock and false for unlock. |
Errors
Error Code | Description |
---|---|
unitNotFound | |
clientNotFound | |
categoryNotFound | |
The unit can't be locked | Returned if user does not have the rights to lock/unlock unit with specified id. |
Locking/Unlocking of unit failed because it already is locked/unlocked | Other parameters are still updated when this error code is returned. |
Parameters
Parameter | Data type | Note |
---|---|---|
id * | String |
Request (example)
{
"id": "39670",
"name": "Peter Andersson",
"categoryId": "30556"
}
Response
{}
Updated less than a minute ago