Assign route to a vehicle
This endpoint creates a new route and route steps and assigns them to the specified vehicle.
Specifying the path
The path needs to be specifyed in each step defined. There are two ways to do this:
Defining the polyline
A polyline may be obtained from the maps service provider.
If you decide to specify the polylines, you need to specify them for every step in the route - not just a for a few steps ; otherwise, Frotcom will use thestarts
andarrive
points, ignoring any polyline that you may have specified.
If you choose not to define the polyline for every step, then you need to define thestarts
andarrive
points ; otherwise, the operation will fail with a "Bad Request" HTTP response.Specifying the
starts
andarrive
points
If you don't define the polyline, then you need to define these points. You may define these endpoint in two ways:Use the ID of a place registered in the company
If you specify the ID of a place, then it's coordinates will be used as the coordinates of the point being defined.Use the GPS coordinates of the point. If you specify the GPS coordinates, these will prevail over the ID of the place.
If you specify the GPS coordinates, then these will be used as the coordinates of the point being defined.
If you specify both, the place ID and and the GPS coordinates, then then the GPS coordinates will be used and the place ID will be ignored.
Parameters
vehicleId
sendToWFMNAV
If true it will send route alert to vehicle terminal WFM/Navigator.
This parameter is specified as part of the request's URL and is specified in the query string.
route
Specifies the caracteristics of the route and the creation options
Example:
{
"code":"string",
"name": "string",
"polyline": "string",
"hereStepPolylines":["string"],
"polylineProvider":"string",
"polylineProviderVersion": "string",
"accountPolylineProvider": "string",
"accountPolylineProviderVersion": "string",
"stepId" 0,
"routeId": 0
"steps": [
{
"createCorridor": false,
"corridorWidth"; 0.0,
"starts":
{
"placeId": 0,
"address": "string",
"planned": "2023-06-02T12:19:26.688Z",
"coordinates" :
{
"latitude": 0.0,
"longitude": 0.0,
}
},
"arrive":
{
"placeId": 0,
"address": "string",
"planned": "2023-06-02T12:19:26.688Z",
"coordinates" :
{
"latitude": 0.0,
"longitude": 0.0,
}
},
"times":
{
"mileage": 0,
"duration": 0,
"breaks": 0,
"stopOver": 0,
"defaultBreak": 0
},
"notifications":
{
"mode": "time",
"delta": 0,
"subject": "string"
"message": "string;
"warnings":
{
"emails": "string",
"phones": "string"
},
"others":
{
"emails": "string",
"phones": "string"
}
},
"alarms":
{
"contacts":
{
"emails": "string",
"phones": "string"
},
"terminal": "notSendAlarm",
"sound": 0,
"playSound": true,
"confirmation": true,
"form": "string",
"formInterval": 0
"warningATDBefore": true,
"warningATDBeforeDuration": 0,
"warningATDAfter": true,
"warningATDAfterDuration": 0,
"warningETABefore": true,
"warningETABeforeDuration": 0,
"warningETAAfter: true,
"warningETAAfterDuration": 0,
"warningETATolerance": true,
"warningETAAfterImidiately": true,
"warningATDAfterImidiately": true
},
"messages":
{
"message" : "string",
"scheduleArriveTime": true,
"destinationPoint" : true,
"jobId" int: Job Id
"taskId" int: Task Id
},
"dragPoints":
[
{
"latitude": 0,
"longitude" : 0
}
]
},
"altDirIndex": 0,
],
"options": General Route directions options
{
"avoidHighways": false,
"reorderingWaypointsAllowed": false,
"avoidTolls": false,
"avoidFerries": false,
"costOptimized": false,
"vehicleClassId": 0,
"vehicleProfileId": 0,
"useDrivingTimeRestrictionsRules": true,
"useExistingVehicleDrivingTime": false,
"vehicleDrivingTimeId": 0,
"coverMaxDistance": false,
"useTeamDrivers": false,
"useClientTimes": false,
"stepToleranceStartTimeBefore": "string",
"stepToleranceStartTimeAfter": "string"
},
"field1": "string"
"field2": "string"
"field3": "string"
}
Field | Description | ||||||||||
vehicleId | The ID of the vehicle to where the route should be assigned
|
||||||||||
code | Route code
|
||||||||||
name | Name of the route. The name of the route can not be empty or nulll.
|
||||||||||
hereStepPolylines | Steps polyline inside a list.(only used internally)
|
||||||||||
polylineProvider | The source of the route polyline, which can either be Google or Here.(only used internally)
|
||||||||||
polylineProviderVersion | The version of the polyline depends on the provider. If the provider is Google, the version is SimplePolyline. If it is Here, the version is FlexiblePolyline. (only used internally)
|
||||||||||
accountPolylineProvider | The map account provider used for the route polyline.(only used internally)
|
||||||||||
accountPolylineProviderVersion | The version of the route polyline depends on the account provider. If the provider is Google, the version is SimplePolyline. If it is Here, the version is FlexiblePolyline. (only used internally)
|
||||||||||
routeId | Route Id if assigning to an existent route
|
||||||||||
steps | Array with all Route Step Definitions
|
||||||||||
steps[i].createCorridor | Specifies if a corridor should be created for the step
|
||||||||||
steps[i].corridorWith | The width of the corridor, in Kilometers
createCorridor is set to true |
||||||||||
polyline | Step polyline drawing
|
||||||||||
steps[i].starts |
Definition of the coordinates of the starting location of the step
|
||||||||||
steps[i].starts.placeId |
The ID of a company's place that defines the starting place
|
||||||||||
steps[i].starts.address |
If departure of the place exists, put the name of place ; otherwise, the name of the departure location address
|
||||||||||
steps[i].starts.planned | The moment when it is expected that the vehicle starts the step.
|
||||||||||
steps[i].starts.coordinates | The GPS coordinates of the arrival location of the step.
|
||||||||||
steps[i].starts.coordinates.latitude |
The latitude of the starting location of the step.
|
||||||||||
steps[i].starts.coordinates.longitude |
The longitude of the starting location of the step.
|
||||||||||
steps[i].arrive |
Definition of the coordinates of the starting location of the step.
|
||||||||||
steps[i].arrive.placeId |
The ID of a company's place that defines the place of arrival.
|
||||||||||
steps[i].arrive.address |
If end of the place exists, put the name of place, otherwise, the name of the end location address.
|
||||||||||
steps[i].arrive.planned | The moment when it is expected that the vehicle reaches the end of the step.
|
||||||||||
steps[i].arrive.coordinates | The GPS coordinates of the arrival location of the step.
|
||||||||||
steps[i].arrive.coordinates.latitude |
The latitude of the arrival location of the step.
|
||||||||||
steps[i].arrive.coordinates.longitude |
The longitude of the arrival location of the step.
|
||||||||||
steps[i].times |
|
||||||||||
steps[i].times.mileage | Mileage in meters.
|
||||||||||
steps[i].times.duration | Duration in minutes.
|
||||||||||
steps[i].times.breaks | Breaks in minutes.
|
||||||||||
steps[i].times.stopOver | Stop over value in minutes.
|
||||||||||
steps[i].times.defaultBreak | If breaks time is not defined, then used the default time.
|
||||||||||
steps[i].notifications |
|
||||||||||
steps[i].notifications |
|
||||||||||
steps[i].notifications.mode | This field defines the mode of sending notifications before estimated arrival.
|
||||||||||
steps[i].notifications.delta | If mode is set to time , then this value is assumed to be in minues;If mode is set to distance , then this value is assumed to be in Kilometers
mode is not none |
||||||||||
steps[i].notifications.subject | Subject of the notification.
|
||||||||||
steps[i].notifications.message | Message of the notification
|
||||||||||
steps[i].notifications |
|
||||||||||
steps[i].notifications.warnings |
|
||||||||||
steps[i].notifications.warnings.emails | Specify one or multiple emails, splitting each with ; .
|
||||||||||
steps[i].notifications.warnings.phones | Specify one or multiple phone numbers, splitting each with ;
|
||||||||||
steps[i].notifications.others |
|
||||||||||
steps[i].notifications.others.emails | Specify one or multiple emails, splitting each with ; .
|
||||||||||
steps[i].notifications.others.phones | Specify one or multiple phone numbers, splitting each with ; .
|
||||||||||
steps[i].alarms | Route Step alarm configurations
|
||||||||||
steps[i].alarms.contacts | Notification contacts to use in case of alarm
|
||||||||||
steps[i].alarms.contacts.emails | Specify one or multiple emails, splitting each with ;
|
||||||||||
steps[i].alarms.contacts.phones | Specifies one or multiple phone numbers, splitting each with ;
|
||||||||||
steps[i].alarms.terminal |
When specified, tells the endpoint to which terminal the alarm should be send
|
||||||||||
steps[i].alarms.sound | Allows to specify the ID of a sound.
|
||||||||||
steps[i].alarms.playSound | If assigned to true and the terminal type selected is sendAlarmToWorkForceManagementTerminal, the alarm will be notified with sound.
|
||||||||||
steps[i].alarms.confirmation | When the terminal type selected is sendAlarmToWorkForceManagementTerminal, a request alarm confirmation may be requires set to true or false if a request alarm confirmation is needed
|
||||||||||
steps[i].alarms.form | If terminal type selected sendAlarmToWorkForceManagementTerminal set with trigger form name.
|
||||||||||
steps[i].alarms.formInterval | Minimum form trigger interval
|
||||||||||
steps[i].alarms.warningATDBefore | If set to true an alert is sent if departure happens earlier than the planned
|
||||||||||
steps[i].alarms.warningATDBeforeDuration | If warningATDBefore is set to true, this field define the time minus in minutes
|
||||||||||
steps[i].alarms.warningATDAfter | If set to true an alert is sent if departure happens later than the planned
|
||||||||||
steps[i].alarms.warningATDAfterDuration | If warningATDAfter is set to true, this field define the time plus in minutes
|
||||||||||
steps[i].alarms.warningETABefore | If set to true an alert is sent
|
||||||||||
steps[i].alarms.warningETABeforeDuration | If warningETABeforeDuration is set to true, this field define the time minus in minutes
|
||||||||||
steps[i].alarms.warningETAAfter | If set to true an alert is sent if arrival happens later than the planned time
|
||||||||||
steps[i].alarms.warningETAAfterDuration | If warningETAAfter is set to true, this field define the time plus in minutes
|
||||||||||
steps[i].alarms.warningETATolerance | If set to true an alert is sent once if estimated arrival time falls outside tolerance
|
||||||||||
steps[i].alarms.warningETAAfterImidiately | If warningETAAfter is set to true, set to true to received an imediate alert as soon the vehicle is late
|
||||||||||
steps[i].alarms.warningATDAfterImidiately | If warningETAAfterDuration is set to true, set to true to received an imediate alert as soon the vehicle is late
|
||||||||||
steps[i].messages | The information sent to driver.
|
||||||||||
steps[i].messages.message | The message text to be sent to driver
|
||||||||||
steps[i].messages.scheduleArriveTime | Send scheduled time of arrival.
|
||||||||||
steps[i].messages.destinationPoint | Send the destination location
|
||||||||||
steps[i].messages.jobId | The ID of the job, if any. If a jobId is specified, then it must correspond to an existing job
|
||||||||||
steps[i].messages.taskId | The ID if the task, if any. If a taskId is specified, then it must correspond to an existing task
|
||||||||||
altDirIndex | The index of a selected alternative path.
|
||||||||||
steps[i].dragPoints | Array of points used to calculate route path
|
||||||||||
options | Options used when requesting the directions route to the maps service
|
||||||||||
options.avoidHighways | Avoid highways
|
||||||||||
options.reorderingWaypointsAllowed | Reorder waypoints to optimize route
|
||||||||||
options.avoidTolls | Avoid tolls
|
||||||||||
options.avoidFerries | Avoid ferries, if possible
|
||||||||||
options.costOptimized | Cover maximum distance using extra hours and reduced rest
|
||||||||||
options.vehicleClassId | The identifier of the vehicle class |
||||||||||
options.vehicleProfileId |
The ID of the profile of the vehicle. The profile of the vehicle may be important the account is configured for using the Advanced routing with Here maps. The list of vehicle profiles can be obtained using the endpoint Gets vehicle classes. |
||||||||||
options.useDrivingTimeRestrictionsRules | Use driving time restriction rules.
|
||||||||||
options.useExistingVehicleDrivingTime | Calculate using current driving time of driver(s)
|
||||||||||
options.vehicleDrivingTimeId | This field indicates the ID of the vehicle which driving times should be considered when calculating the route times of arrival and departure. If null, the driving times aren't applied.
|
||||||||||
options.coverMaxDistance | If set to true Cover maximum distance using extra hours and reduced rest.
|
||||||||||
options.useTeamDrivers | If set to true, use team drivers.
|
||||||||||
options.useClientTimes | Use step start and arrival planned times passed in the body.
|
||||||||||
options.stepToleranceStartTimeBefore | If set to a valid time, overrides the «Start Tolerance» > «Before Start Time» in the route account configuration. If missing or invalid, falls back to the account configuration. |
||||||||||
options.stepToleranceStartTimeAfter | If set to a valid time, overrides the «Start Tolerance» > «After Start Time» in the route account configuration. If missing or invalid, falls back to the account configuration. |
||||||||||
field1 | Any type of information of a vehicle
|
||||||||||
field2 | Any type of information of a vehicle
|
||||||||||
field3 | Any type of information of a vehicle
|
Note: The fields that are not mencioned in this list are not being used.
Response content
{
"Id": 0
"RouteExecutionId":
{
"Id": 0
}
}
Field | Description |
Id | The ID the route
|
RouteExecutionId.Id | The ID of the created route execution
|
Response HTTP Codes
201 - Created
- The route was successfully assigned to the vehicle
204 - No content
400 - Bad Request
Route
isnull
Route.Steps
is null orempty
Route.Name
isnull
orempty
Route.Code
is notnull
andlength
>10
Route.Steps.corridorWidth
width below0.01
Route.Steps.PlaceId
is invalidRoute.Steps.Coordinates
arenull
Route.Steps.Planned
isnull
Route.Notifications
Time/Distance with deltanull
or below0
Route.Notifications.Warmings
is notnull
andemails
orphones
arenull
or invalidRoute.Notifications.Others
is notnull
andemails
orphones
arenull
or invalidRoute.Alarms.Contacts
is notnull
andemails
orphones
arenull
or invalidRoute.Messages
is notnull
and JobId is different or above0
and invalidRoute.Messages
is notnull
andJobId
different or above0
and invalidIf an error ocurrs while obtaining data from the Directions Service
When not using polylines, if
Starts
orArrival
objects are not specifiedIf the
Planned
timestamp of a step'sStart
is before thePlanned
timestamp of the previous step'sArrival
401 - Unauthorized
- Invalid credencials
- If the user doesn't have permission to request a directcions route from the maps service
403 - Forbidden
- If the authenticated user doesn t have permission to create/edit routes
404 - Not found
- If the vehicleId is not related to user
- If an error occurs when creating the polyline
409 - Conflict
- If route for that vehicle is overlapping with another one
- If the vehicles have WFM and Navigator associated.
- If it was WFM and we come from multiple Jobs creating a single route
- If the vehicle has a NAV device but passing both messages and jobs