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

NameData typeUnit of measurementNote
id *StringN/AIf supplied, we return only that unit. If not, we return all units (taking into account other parameters).
serialNumberStringN/A
referenceNumberStringN/AIf supplied, we only return units that belong to a specified reference number.
categoryIdStringN/AIf supplied, we only return units that belong to a specified category.
clientIdStringN/AIf supplied, we only return units that belong to a specified client.
groupIdStringN/AIf supplied, we only return units that belong to a specified group.
zoneIdStringN/AIf supplied, we return only units currently located inside a specified zone.
pointIdStringN/AIf 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.
pointLocationDecimal degrees. Latitude = [-90, 90], Longitude = [-180, 180].Same as with PointId. Specify location by use of a Lat/Lon.
radiusdoublekmRadius to search within. Default value is 1 kilometer. Valid value is > 0 and < 40000 km.

Errors

Error CodeDescription
unitNotFoundUnit with supplied “Id” was not found.
categoryNotFoundCategory with supplied “CategoryId” was not found.
clientNotFoundClient with supplied “ClientId” was not found.
groupNotFoundGroup with supplied “GroupId” was not found.
zoneNotFoundZone with supplied “ZoneId” was not found.
pointNotFoundPoint with supplied “PointId” was not found.

Columns

Refer to the following table for description of parameters:

NameData typeUnit of measurementNullabilityNote
idStringN/AFALSEUnique identifier.
serialNumberStringN/AFALSEUnit GSM number.
phoneNumberStringN/ATRUE
vehicleTypeStringN/AFALSE
deviceTypeStringN/AFALSEThe model of the unit.
deviceModelStringN/AFALSEThe model of the unit
nameStringN/AFALSE
displayNameStringN/AFALSEThe full display name with category name prefixed.
referenceNumberStringN/ATRUE
noteStringN/ATRUE
createdAtDateTimeN/ATRUETime of creation.
input1NameStringN/ATRUE
input2NameStringN/ATRUE
input3NameStringN/ATRUE
input4NameStringN/ATRUE
categoryIdStringN/ATRUE
clientIdStringN/ATRUE
keyIdStringN/ANULL
If unit never reported it or there is no driver logged in.
gpsFixTimeDateTimeUTC timeNULL
If unit never reported valid GPS fix.
messageTimeDateTimeUTC timeNULL
If unit never reported at all.
locationLocationN/ATRUE
altitudeDoublekmTRUEAbove sea level.
headingIntDegreesTRUE0 to 359 degrees. 0 means straight north direction, 90 - straight east etc.
speedDoublekm/hTRUECurrent speed.
addressAddressN/ATRUE
temperature1DoubleCelcius degreesTRUETemperature sensor 1 value.
temperature2DoubleCelcius degreesTRUETemperature sensor 2 value.
gsmLevelDoubleN/ATRUEGSM signal level.
gsmSignalQualityStringN/ATRUEGSM signal quality, i.e. “Good” / “Bad”.
gpsSignalQualityStringN/ATRUEGPS signal quality, i.e. “Good” / “Bad”.
batteryLevelDoublePercentTRUEInternal battery level.
externalPowerDoubleVoltTRUEExternal power voltage.
preRun1DoubleSecondsFALSEFixed value to append to hour meter on input 1.
preRun2DoubleSecondsTRUEFixed value to append to hour meter on input 2.
run1DoubleSecondsTRUEHour meter to Input 1.
run2DoubleSecondsTRUEHour meter to Input 2.
run3DoubleSecondsTRUEHour meter to Input 3.
run4DoubleSecondsTRUEHour meter to Input 4.
runOdoDoubleSecondsFALSEHou rmeter for driving.
preKmDoubleKmFALSEFixed value to append to Km.
kmDoubleKmTRUETotal km driven.
input1BoolN/ATRUEStatus of input 1.
input2BoolN/ATRUEStatus of input 2.
input3BoolN/ATRUEStatus of input 3.
input4BoolN/ATRUEStatus of input 4.
input5BoolN/ATRUEStatus of input 5.
input6BoolN/ATRUEStatus of input 6.
input7BoolN/ATRUEStatus of input 7.
input8BoolN/ATRUEStatus of input 8.
input9BoolN/ATRUEStatus of input 9.
input10BoolN/ATRUEStatus of input 10.
output1BoolN/ATRUEStatus of output 1.
output2BoolN/ATRUEStatus of output 2.
output3BoolN/ATRUEStatus of output 3.
output4BoolN/ATRUEStatus of output 4.
output5BoolN/ATRUEStatus of output 5.
analogInput1DoubleVoltTRUEVoltage on analog input 1.
analogInput2DoubleVoltTRUEVoltage on analog input 2.
analogInput4DoubleVoltTRUEVoltage on analog input 4.
input1ChangeCounterIntN/ATRUENumber of input cycles on input 1.
input2ChangeCounterIntN/ATRUENumber of input cycles on input 2.
input3ChangeCounterIntN/ATRUENumber of input cycles on input 3.
input4ChangeCounterIntN/ATRUENumber of input cycles on input 4.
isActiveBoolN/AFALSEIndicates whether unit is active or inactive.
isOwnBoolN/ATRUEIndicates whether the unit is owned by customer using the API, or not.
currentStopDoubleSecondsTRUECurrent 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

NameData typeUnit of measurementDescription
id *StringId of unit to update.
nameStringName of unit.
referenceNumberStringSpecify empty string to clear current value.
vehicleTypeStringUnit type, either car, machine or boat
clientIdStringId of new client. Specify empty string to clear current value.
preKmDoubleKilometers
preRun1DoubleSeconds
preRun2DoubleSeconds
noteStringSpecify empty string to clear current value.
isActiveBool
input1NameStringSpecify empty string to clear current value.
input2NameStringSpecify empty string to clear current value.
input3NameStringSpecify empty string to clear current value.
input4NameStringSpecify empty string to clear current value.
lockBoolLock of unit. Specify true for lock and false for unlock.

Errors

Error CodeDescription
unitNotFound
clientNotFound
categoryNotFound
The unit can't be lockedReturned if user does not have the rights to lock/unlock unit with specified id.
Locking/Unlocking of unit failed because it already is locked/unlockedOther parameters are still updated when this error code is returned.

Parameters

ParameterData typeNote
id *String

Request (example)

{
  "id": "39670",
  "name": "Peter Andersson",
  "categoryId": "30556"
}

Response

{}