Authorization
Bearer <YOUR-API-KEY>
id
and type
obtained in the previous step. This only needs to be done once./v1/integrations/onfleet/run
endpoint with a JSON
body that follows the input schema to route and assign the desired tasks and workers, using the run profile id
obtained in the previous step with the run_profile
key. The API server should return a run_id
that you will use to query your results. This means that a Nextmv solver has been spun up to solve the model with the given input. The time it takes to finish execution varies by the size of the input and solver options./v0/run/{run_id}/status
endpoint, using the run_id
. Once the status is succeeded
, you can query your results. Please see our section on using the API for more information./v0/run/{run_id}/result
endpoint, using the run_id
. The result holds the Onfleet containers that represent the final assignments of tasks to workers and it will follow the structure of the output schema. Please see our section on using the API for more information./v1/routing/profiles/integration/onfleet
endpoint with a JSON
payload that follows this schema:name
"Sample Onfleet integration key"
string
description
"Sample Onfleet integration description"
string
id
"onfleet-key"
string
configuration
{ "api_key": "<YOUR_ONFLEET_API_KEY>" }
object
configuration
object allows you to securely store your Onfleet API key and optionally set up the compatibility
feature explained below.api_key
"<YOUR_ONFLEET_API_KEY>"
string
compatibility
{ "tasks": {"quantity": false}, "workers": {"capacity": false} }
object
compatibility
object allows you to fine-tune which task and worker attributes are automatically parsed when supported by compatible functionality. Using the compatibility
feature is optional. Any attribute that is not explicitly defined as false
will be automatically parsed as true
. The object follows this schema:tasks
{ "service_time": false, "quantity": true }
object
workers
{ "capacity": false, "tasks": true }
object
tasks
and workers
object, respectively.complete_before_after
completeBefore
and completeAfter
into a Nextmv stop's hard_window
.false
boolean
dependencies
dependencies
into Nextmv stop's succeeds
.false
boolean
location
destination.location
into the Nextmv stop's position
. NOTE: if you turn this toggle off (false
) you should make sure that you are specifying position
via task metadata, otherwise your stop will not have a location and will cause an error.false
boolean
quantity
quantity
into the Nextmv stop's quantity
.false
boolean
service_time
serviceTime
into the Nextmv stop's stop_duration
.false
boolean
active_task
activeTask
to be part of the Nextmv vehicle's backlog
.false
boolean
capacity
capacity
into the Nextmv vehicle's capacity
.false
boolean
location
location
into the Nextmv vehicle's start
position.false
boolean
tasks
tasks
to be part of the Nextmv vehicle's backlog
.false
boolean
id
and type
, as you will need them to add the integration to your run profile. Please note that you may set up multiple integration profiles using this method. You only need to do this process once for each API key.PUT /v1/routing/profiles/integration/onfleet/{profile_id}
endpoint with a JSON
payload that follows the same schema as when creating a new integration (described in the table above). Note that you may not modify the original id
.compatibility
feature in the Onfleet integration profile.completeBefore
, completeAfter
number
1609522200
, 1609529400
[2]time.Time
[ "2021-01-01T12:30:00-00:00", "2021-01-01T14:30:00-00:00" ]
destination.location
array
number
[ 1.23, 4.56 ]
position
map[string]int
{ "lon": 1.23, "lat": 4.56 }
pickupTask
on the task is set to true
, the quantity
will default to be negative, regardless of how it is set.serviceTime
(minutes) is converted to stop_duration
(seconds), given that durations are handled in seconds inside of the Nextmv Cloud API.location
array
number
[ 2.294223, 48.858591 ]
map[string]float64
{ "lon": 2.294223, "lat": 48.858591 }
activeTask
and tasks
, if defined, are parsed to be part of the backlog
. Additional tasks can be added to the backlog if the worker is extended with the backlog metadata entry.name
of each metadata object should follow this pattern:version
dictates the metadata version used and attribute
is the name of the Nextmv attribute used to extend the task or worker. An example of a name is: "nextmv:0.1:unassigned_penalty"
, used to set an unassigned penalty for a task (stop). You may use all (or none) supported metadata extensions for both tasks and workers. In the following tables you will find a list of these attributes.position
"object"
map[string]float64
{ "name": "nextmv:0.1:position", "type": "object", "value": { "lon": 1.23, "lat": 4.56 } }
"number"
int
{ "name": "nextmv:0.1:unassigned_penalty", "type": "number", "value": 10500 }
"object"
map[string]int
{ "name": "nextmv:0.1:quantity", "type": "object", "value": { "volume": 400, "weight": 600 } }
"array"
"string"
[]string
{ "name": "nextmv:0.1:precedes", "type": "array", "subtype": "string", "value": [ "id-1", "id-2" ] }
"string"
time.Time
{ "name": "nextmv:0.1:target_time", "type": "string", "value": "2021-10-17T09:45:00-06:00" }
"number"
float64
{ "name": "nextmv:0.1:earliness_penalty", "type": "number", "value": 125.1 }
"number"
float64
{ "name": "nextmv:0.1:lateness_penalty", "type": "number", "value": 125.1 }
"array"
"string"
[]string
{ "name": "nextmv:0.1:compatibility_attributes", "type": "array", "subtype": "string", "value": [ "comp-1", "comp-2" ] }
quantity
is for multi-capacity. You can use a single capacity dimension, in which case the Onfleet type is "number"
and the Nextmv type is int
.quantity
is defined in the Onfleet task and through metadata, a multi-quantity type will be used. This applies to both metadata cases: an object with multiple dimensions or a single numerical quantity.precedes
is for multi-precedes. You can use a single ID for precedes
, in which case the Onfleet type is "string"
and the Nextmv type is string
."object"
map[string]float64
{ "name": "nextmv:0.1:start", "type": "object", "value": { "lon": 2.294223, "lat": 48.858591 } }
"object"
map[string]float64
{ "name": "nextmv:0.1:end", "type": "object", "value": { "lon": 2.294223, "lat": 48.858591 } }
"object"
map[string]int
{ "name": "nextmv:0.1:capacity", "type": "object", "value": { "volume": 4000, "weight": 6000 } }
"string"
time.Time
{ "name": "nextmv:0.1:shift_start", "type": "string", "value": "2021-10-17T09:45:00-06:00" }
"string"
time.Time
{ "name": "nextmv:0.1:shift_end", "type": "string", "value": "2021-10-17T09:45:00-06:00" }
"array"
"string"
[]string
{ "name": "nextmv:0.1:compatibility_attributes", "type": "array", "subtype": "string", "value": [ "comp-1", "comp-2" ] }
"number"
int
{ "name": "nextmv:0.1:max_distance", "type": "number", "value": 1000 }
"number"
int
{ "name": "nextmv:0.1:max_duration", "type": "number", "value": 3600 }
"number"
float64
{ "name": "nextmv:0.1:stop_duration_multiplier", "type": "number", "value": 1.5 }
"array"
"string"
[]string
{ "name": "nextmv:0.1:backlog", "type": "array", "subtype": "string", "value": [ "id-1", "id-2" ] }
"array"
"string"
[]string
{ "name": "nextmv:0.1:alternate_stops", "type": "array", "subtype": "string", "value": [ "id-1", "id-2" ] }
"number"
int
{ "name": "nextmv:0.1:initialization_cost", "type": "number", "value": 1500 }
location
is null
, so you can use the start
attribute to define where the route should start. If the starting location is defined through metadata, it overrides the worker's location
attribute.start
and end
to represent routes with depots.capacity
is for multi-capacity. You can use a single capacity dimension, in which case the Onfleet type is "number"
and the Nextmv type is int
.capacity
is defined in the Onfleet worker and through metadata, a multi-capacity type will be used. This applies to both metadata cases: an object with multiple dimensions or a single numerical quantity.shift_start
and shift_end
metadata attributes. We do not support native Onfleet worker schedules given that they may contain multiple shifts.JSON
payload that has the following keys:.json
file.routing
object is provided as part of the input schema below.tasks
object
workers
object
alternate_stops
it is mandatory to create the alternate_stops
as tasks per worker in Onfleet before calling the Nextmv API. E.g., if you have two locations that are alternate_stops
and you have 5 workers, you need to create 2*5=10 tasks. You can then call the Nextmv API. Once you have the Nextmv results with the calculated routes, the unused alternate_stops
need to be deleted from Onfleet. This can be done by looping over the routes and identifying which alternate_stops
appear there. The alternate_stops
that are not found in the routes should be removed from Onfleet and the containers can be updated.tasks
object is composed of the following keys:ids
[ "zntJ8QG5LPBK9mMea6zWN0lB", "cisx30t05*kQQiKYQhgyTmVF" ]
array
of string
params
lastId
query parameter should not be specified, as the pagination is done automatically by the Nextmv Cloud API.{ "from": 1641963600000 }
object
snake_case
. For example: complete_before_before
and complete_after_after
.stop_groups
, please include the list of task IDs in both the list of task
ids
and the list of IDs in a group inside stop_groups
.task
ids
and the list of alternate_stops
. This is handled differently than in the original alternate stops feature, where alternate stops are only specified under the alternate_stops
key but not under stops
. Keep in mind that alternate_stops
are specified only using task IDs, not a stop object.workers
object is composed of the following keys:ids
[ "aWXnPY3NjKSOdisBihX8QPsL" ]
array
of string
params
are required for tasks
(the from
key is the only non-optional parameter) but are optional for workers
. A sample onfleet
object is provided as part of the input schema below.JSON
response that has the following keys:containers
array
of object
input
object
.json
file.