Driver management API

The main purpose of the Driver management API is to manage (create, edit, delete) drivers.

Creating drivers

POST /management/driver?version=1&api_key=<...>
HOST: api.fm-track.com
Content-Type: application/json;charset=UTF-8
BODY: { "first_name": "Driver", "last_name": "McDriver", "address": "Lithuania, Vilnius", "phone": "+3700000000", "identifiers": [ { "identifier": "343234323432342", "type": "DLT" }, { "identifier": "0123456789", "type": "TACHOGRAPH" }, { "identifier": "3AC64785D2FF", "type": "WIRELESS" }, { "identifier": "123456789", "type": "IBUTTON" } ] }

This request has the following parameters:

ParameterTypeArrayDescriptionRequired
versionStringVersion of the APIYes
api_keyStringUser identification keyYes
first_nameStringThe driver’s first name
Maximum length: 250
Yes
last_nameStringThe driver’s last name
Maximum length: 250
No
addressStringThe driver's address
Maximum length: 250
No
phoneStringThe driver's telephone number
Maximum length: 30
No
identifiersArrayContainer for identification codesNo
identifierStringidentifiersIdentification code
Length (TACHOGRAPH): 10-16
Length (DLT): 15-18
Maximum length (WIRELESS, IBUTTON): 20

All codes must be unique among all of the user's existing drivers.
No
typeStringidentifiers Identification code type
Possible values:
DLT
TACHOGRAPH
WIRELESS
IBUTTON
No

A response example is shown below:

 {
    "id": "ABC123",
    "first_name": "Driver",
    "last_name": "McDriver",
    "address": "Lithuania, Vilnius",
    "phone": "+3700000000",
    "identifiers": [
        {
            "identifier": "343234323432342",
            "type": "DLT"
        },
        {
            "identifier": "0123456789",
            "type": "TACHOGRAPH"
        },
        {
            "identifier": "3AC64785D2FF",
            "type": "WIRELESS"
        },
        {
            "identifier": "123456789",
            "type": "IBUTTON"
        }
    ]
}

Note
Parameters without values will be left empty.

Response parameters are described in the following table:

ParameterTypeArrayDescriptionUnits
idStringDriver identifierText
first_nameStringThe driver’s first nameText
last_nameStringThe driver’s last nameText
addressStringThe driver's addressText
phoneStringThe driver's telephone numberText
identifiersArrayContainer for identification codes
identifierStringidentifiersIdentification codeText
typeStringidentifiersIdentification code type
Possible values:
DLT
TACHOGRAPH
WIRELESS
IBUTTON
Text

Response examples for incorrect requests are shown below:

{
    "code": 409,
    "message": "Another driver with identifier [123456789] already exists."
}
{
    "code": 422,
    "message": "Validation failed, see 'fieldValidationErrors' for more details",
    "field_validation_errors": [
        {
            "field": "phone",
            "reason": "size must be between 0 and 30",
            "rejected_value": "13245678903216549870123456789032123212321"
        },
        {
            "field": "identifiers",
            "reason": "length for IBUTTON must be between 1 and 20",
            "rejected_value": "[identifier: 1351465465413241324134135135135135413.2132463521321525555, type: IBUTTON]"
        },
        {
            "field": "firstName",
            "reason": "must not be empty",
            "rejected_value": "<null value>"
        }
    ]
}
{
    "code": 422,
    "message": "Validation failed, see 'fieldValidationErrors' for more details",
    "field_validation_errors": [
        {
            "field": "identifiers",
            "reason": "There can only be one entry for each identifier type.",
            "rejected_value": "[{ identifier: abc, type: IBUTTON }, { identifier: fgs, type: IBUTTON }, { identifier: 1234567A, type: IBUTTON }, { identifier: 1234567A1234567A, type: TACHOGRAPH }, { identifier: 1234567A1234F, type: TACHOGRAPH }]"
        }
    ]
}

Error parameters are described in the following table:

ParameterDescription
codeValidation error code
Possible values:
409 - another driver with the same identifier already exists
422 - the value is invalid
messageError message:
Possible values:
Another driver with identifier [] already exists (error code 409)
Validation failed, see 'fieldValidationErrors' for more details (error code 422)
field_validation_errorsArray for validation errors
fieldThe field with invalid value(s)
reasonWhy the value is invalid. Refer to the parameter description for accepted parameter value ranges.
rejected_valueThe rejected value(s)

Editing drivers

PUT /management/driver/{driverId}?version=1&api_key=<...>
HOST: api.fm-track.com
Content-Type: application/json;charset=UTF-8
 
 
BODY:
    {
    "first_name": "Driver",
    "last_name": "McDriver",
    "address": "Lithuania, Vilnius",
    "phone": "+3700000000",
   	"identifiers": [
        {
            "identifier": "343234323432342",
            "type": "DLT"
        },
        {
            "identifier": "0123456789",
            "type": "TACHOGRAPH"
        },
        {
            "identifier": "3AC64785D2FF",
            "type": "WIRELESS"
        },
        {
            "identifier": "123456789",
            "type": "IBUTTON"
        }
    ]
}

This request has the following parameters:

ParameterTypeArrayDescriptionRequired
driverIdStringDriver identifierYes
versionStringVersion of the APIYes
api_keyStringUser identification keyYes
first_nameStringThe driver’s first name
Maximum length: 250
No
last_nameStringThe driver’s last name
Maximum length: 250
No
addressStringThe driver's address
Maximum length: 250
No
phoneStringThe driver's telephone number
Maximum length: 30
No
identifiersArrayContainer for identification codesNo
identifierStringidentifiers Identification code
Length (TACHOGRAPH): 10-16
Length (DLT): 15-18
Maximum length (WIRELESS, IBUTTON): 20

All codes must be unique among all of the user's existing drivers.
No
typeStringidentifiersIdentification code type
Possible values:
DLT
TACHOGRAPH
WIRELESS
IBUTTON
No

Note
Parameters without values will be left empty.

A response example is shown below:

 {
    "id": "ABC123",
    "first_name": "Driver",
    "last_name": "McDriver",
    "address": "Lithuania, Vilnius",
    "phone": "+3700000000",
    "identifiers": [
        {
            "identifier": "343234323432342",
            "type": "DLT"
        },
        {
            "identifier": "0123456789",
            "type": "TACHOGRAPH"
        },
        {
            "identifier": "3AC64785D2FF",
            "type": "WIRELESS"
        },
        {
            "identifier": "123456789",
            "type": "IBUTTON"
        }
    ]
}
ParameterTypeArrayDescriptionUnits
idStringDriver identifierText
first_nameStringThe driver’s first nameText
last_nameStringThe driver’s last nameText
addressStringThe driver's addressText
phoneStringThe driver's telephone numberText
identifiersArrayContainer for identification codes
identifierStringidentifiersIdentification codeText
typeStringidentifiersIdentification code type
Possible values:
DLT
TACHOGRAPH
WIRELESS
IBUTTON
Text

Response examples for incorrect requests are shown below:

{
    "code": 409,
    "message": "Another driver with identifier [123456789] already exists."
}
{
    "code": 422,
    "message": "Validation failed, see 'fieldValidationErrors' for more details",
    "field_validation_errors": [
        {
            "field": "phone",
            "reason": "size must be between 0 and 30",
            "rejected_value": "13245678903216549870123456789032123212321"
        },
        {
            "field": "identifiers",
            "reason": "length for IBUTTON must be between 1 and 20",
            "rejected_value": "[identifier: 1351465465413241324134135135135135413.2132463521321525555, type: IBUTTON]"
        },
        {
            "field": "firstName",
            "reason": "must not be empty",
            "rejected_value": "<null value>"
        }
    ]
}
{
    "code": 422,
    "message": "Validation failed, see 'fieldValidationErrors' for more details",
    "field_validation_errors": [
        {
            "field": "identifiers",
            "reason": "There can only be one entry for each identifier type.",
            "rejected_value": "[{ identifier: abc, type: IBUTTON }, { identifier: fgs, type: IBUTTON }, { identifier: 1234567A, type: IBUTTON }, { identifier: 1234567A1234567A, type: TACHOGRAPH }, { identifier: 1234567A1234F, type: TACHOGRAPH }]"
        }
    ]
}

Error parameters are described in the following table:

ParameterDescription
codeValidation error code
Possible values:
409 - another driver with the same identifier already exists
422 - the value is invalid
messageError message:
Possible values:
Another driver with identifier [] already exists (error code 409)
Validation failed, see 'fieldValidationErrors' for more details (error code 422)
field_validation_errorsArray for validation errors
fieldThe field with invalid value(s)
reasonWhy the value is invalid. Refer to the parameter description for accepted parameter value ranges.
rejected_valueThe rejected value(s)

Deleting drivers

DELETE /management/driver/{driverId}?version=1&api_key=<...>
HOST: api.fm-track.com
Content-Type: application/json;charset=UTF-8
    
BODY:        
{
"id": "abc123"
}

The following parameters are mandatory for this request:

ParameterTypeDescription
driverIdStringDriver identifier
versionStringVersion of the API
api_keyStringUser identification key