Optimize Route by Distance

This API call enables the optimization of an individual’s daily route. It intelligently reorders jobs to create an optimized route, focusing on minimizing travel distance while prioritizing high-priority jobs. This optimization process is immediate, requiring no additional saving or editing actions. If the date is set to today, workers will be promptly notified of their updated job order.

Key Features:

  • Priority and Distance Focused: Prioritizes high-priority jobs while minimizing the overall travel distance.
  • Dynamic Route Start/End Points:
    • Primarily, the worker’s specified start/end locations are used.
    • If not set, the team’s start location is considered.
    • In the absence of both, the first and last jobs of the day determine the route’s endpoints.
  • Route Start Time: Determined based on the worker’s specified working hours.
  • Travel mode: Determined based on the worker’s travel mode setting (Car, Bicycle, Pedestrian, Truck, Van, Motorcycle).

Note:

  • Currently, this route optimization does not support specific time windows for jobs or locations.
  • Route optimization naturally only works if all jobs are accessible via car or any vehicle.
  • Also see: /distributejobs and /autoassign endpoints.

REQUEST

POST https://api.hellotracks.com/api/optimizeroute

{
	data: {
		day: 20221125,
		account: <worker-username-or-uid>,
	}
}
day
number
required

The date in number format: YYYYMMMDD, e.g. 20221125 equals to Nov 25, 2022.

account
string
required

Worker’s uid order username.

RESPONSE

{
	status: 0,
	jobs: [{<job1>}, {<job2>} ... ],
	original_order: [{<job1>}, {<job2>} ... ],
	route_updated: <bool>
}
jobs
array

The newly arranged jobs representing the optimized route.

original_job
array

The original order of jobs representing the prior route before optimization. Useful e.g. for undo functionality.

route_updated
boolean

true if a route optimization was successfully applied.