Основним призначенням API керування драйверами є керування (створення, редагування, видалення) драйверами.
Створення драйверів
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" } ] }
Цей запит має наступні параметри:
| Parameter | Type | Array | Description | Required |
|---|---|---|---|---|
| version | String | Version of the API | Yes | |
| api_key | String | User identification key | Yes | |
| first_name | String | The driver’s first name Maximum length: 250 | Yes | |
| last_name | String | The driver’s last name Maximum length: 250 | No | |
| address | String | The driver's address Maximum length: 250 | No | |
| phone | String | The driver's telephone number Maximum length: 30 | No | |
| identifiers | Array | Container for identification codes | No | |
| identifier | String | identifiers | 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 |
| type | String | identifiers | Identification code type Possible values: DLT TACHOGRAPH WIRELESS IBUTTON | No |
Приклад відповіді наведено нижче:
{
"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"
}
]
}
Примітка
Параметри без значень залишаться порожніми.
Параметри реакції описані в наступній таблиці:
| Parameter | Type | Array | Description | Units |
|---|---|---|---|---|
| id | String | Driver identifier | Text | |
| first_name | String | The driver’s first name | Text | |
| last_name | String | The driver’s last name | Text | |
| address | String | The driver's address | Text | |
| phone | String | The driver's telephone number | Text | |
| identifiers | Array | Container for identification codes | ||
| identifier | String | identifiers | Identification code | Text |
| type | String | identifiers | Identification code type Possible values: DLT TACHOGRAPH WIRELESS IBUTTON | Text |
Приклади відповідей на некоректні запити наведені нижче:
{
"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 }]"
}
]
}
Параметри помилок описані в наступній таблиці:
| Parameter | Description |
|---|---|
| code | Validation error code Possible values: 409 - another driver with the same identifier already exists 422 - the value is invalid |
| message | Error message: Possible values: Another driver with identifier [ Validation failed, see 'fieldValidationErrors' for more details (error code 422) |
| field_validation_errors | Array for validation errors |
| field | The field with invalid value(s) |
| reason | Why the value is invalid. Refer to the parameter description for accepted parameter value ranges. |
| rejected_value | The rejected value(s) |
Редагування драйверів
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"
}
]
}
Цей запит має наступні параметри:
| Parameter | Type | Array | Description | Required |
|---|---|---|---|---|
| driverId | String | Driver identifier | Yes | |
| version | String | Version of the API | Yes | |
| api_key | String | User identification key | Yes | |
| first_name | String | The driver’s first name Maximum length: 250 | No | |
| last_name | String | The driver’s last name Maximum length: 250 | No | |
| address | String | The driver's address Maximum length: 250 | No | |
| phone | String | The driver's telephone number Maximum length: 30 | No | |
| identifiers | Array | Container for identification codes | No | |
| identifier | String | identifiers | 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 |
| type | String | identifiers | Identification code type Possible values: DLT TACHOGRAPH WIRELESS IBUTTON | No |
Примітка
Параметри без значень залишаться порожніми.
Приклад відповіді наведено нижче:
{
"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"
}
]
}
| Parameter | Type | Array | Description | Units |
|---|---|---|---|---|
| id | String | Driver identifier | Text | |
| first_name | String | The driver’s first name | Text | |
| last_name | String | The driver’s last name | Text | |
| address | String | The driver's address | Text | |
| phone | String | The driver's telephone number | Text | |
| identifiers | Array | Container for identification codes | ||
| identifier | String | identifiers | Identification code | Text |
| type | String | identifiers | Identification code type Possible values: DLT TACHOGRAPH WIRELESS IBUTTON | Text |
Приклади відповідей на некоректні запити наведені нижче:
{
"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 }]"
}
]
}
Параметри помилок описані в наступній таблиці:
| Parameter | Description |
|---|---|
| code | Validation error code Possible values: 409 - another driver with the same identifier already exists 422 - the value is invalid |
| message | Error message: Possible values: Another driver with identifier [ Validation failed, see 'fieldValidationErrors' for more details (error code 422) |
| field_validation_errors | Array for validation errors |
| field | The field with invalid value(s) |
| reason | Why the value is invalid. Refer to the parameter description for accepted parameter value ranges. |
| rejected_value | The rejected value(s) |
Видалення драйверів
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:
| Parameter | Type | Description |
|---|---|---|
| driverId | String | Driver identifier |
| version | String | Version of the API |
| api_key | String | User identification key |