update_drive_rank_settings
To update eco driving criteria of a unit, use the unit/update_drive_rank_settings method.
Endpoint
svc=unit/update_drive_rank_settings¶ms={
"itemId": <long>,
"driveRank": {
"acceleration": [
{
"flags": <uint>,
"min_value": <double>,
"max_value": <double>,
"min_speed": <uint>,
"max_speed": <uint>,
"min_duration": <uint>,
"max_duration": <uint>,
"validator_id": <long>,
"name": <text>,
"penalties": <uint>
},
...
],
"brake": [
{
"flags": <uint>,
"min_value": <double>,
"max_value": <double>,
"min_speed": <uint>,
"max_speed": <uint>,
"min_duration": <uint>,
"max_duration": <uint>,
"validator_id": <long>,
"name": <text>,
"penalties": <uint>
},
...
],
"turn": [
{
"flags": <uint>,
"min_value": <double>,
"max_value": <double>,
"min_speed": <uint>,
"max_speed": <uint>,
"min_duration": <uint>,
"max_duration": <uint>,
"validator_id": <long>,
"name": <text>,
"penalties": <uint>
},
...
],
"sensor": [
{
"flags": <uint>,
"min_value": <double>,
"max_value": <double>,
"min_speed": <uint>,
"max_speed": <uint>,
"min_duration": <uint>,
"max_duration": <uint>,
"validator_id": <long>,
"sensor_id": <long>,
"name": <text>,
"penalties": <uint>
},
...
],
"speeding": [
{
"flags": <uint>,
"min_value": <double>,
"max_value": <double>,
"min_speed": <uint>,
"max_speed": <uint>,
"min_duration": <uint>,
"max_duration": <uint>,
"validator_id": <long>,
"name": <text>,
"penalties": <uint>
},
...
],
"harsh": [
{
"flags": <uint>,
"min_value": <double>,
"max_value": <double>,
"min_speed": <uint>,
"max_speed": <uint>,
"min_duration": <uint>,
"max_duration": <uint>,
"validator_id": <long>,
"name": <text>,
"penalties": <uint>
},
...
],
"idling": [
{
"flags": <uint>,
"min_value": <double>,
"max_value": <double>,
"min_speed": <uint>,
"max_speed": <uint>,
"min_duration": <uint>,
"max_duration": <uint>,
"validator_id": <long>,
"name": <text>,
"penalties": <uint>
},
...
],
"global": {
"accel_mode": <uint>
}
}
}
Parameters
The request must contain the following parameters:
| Parameter | Description |
|---|---|
itemId |
Unit ID. |
driveRank |
Object with the eco driving criteria (see Eco driving criteria). The object replaces all the current eco driving settings of the unit, so the criteria that you don’t include are deleted. To delete all criteria, send an empty object. |
Eco driving criteria
Each criterion type is an array of criteria. Include only the types that you need.
| Parameter | Description |
|---|---|
acceleration |
Acceleration. |
brake |
Braking. |
turn |
Turn. |
sensor |
Custom criterion based on sensor values. |
speeding |
Speeding. |
harsh |
Harsh driving. |
idling |
Idling. |
global |
Object with the general settings. It contains the accel_mode parameter, which sets the acceleration calculation method:
|
Criterion settings
| Parameter | Description |
|---|---|
flags |
Flags:
|
min_value |
Minimum value of the criterion. The unit of measurement depends on the criterion:
|
max_value |
Maximum value of the criterion (excluded). The unit of measurement is the same as for min_value. |
min_speed |
Minimum speed, in km/h, or in mph if the unit uses the US or imperial measurement system. |
max_speed |
Maximum speed (excluded), in the same unit of measurement as min_speed. |
min_duration |
Minimum duration of the violation, in seconds. |
max_duration |
Maximum duration of the violation, in seconds. If a violation lasts longer, it’s counted as several violations: one for each max_duration interval, including the last shorter one. |
validator_id |
Validator sensor ID. |
sensor_id |
Sensor ID. It’s used only for the sensor criterion. |
name |
Criterion name. |
penalties |
Penalty points. |
Response
If the request is completed successfully, an empty object is returned:
{}
If the request fails, an error code is returned.
Error codes
| Error code | Description |
|---|---|
| 4 | Wrong input parameters, for example, the driveRank parameter is missing or isn’t an object. |
| 6 | Failed to update the eco driving criteria. |
| 7 | The unit doesn’t exist, or the user doesn’t have the Edit trip, driving and health check settings access right to it. |