Automatically assign list of tasks

Automatically assign list of tasks

Existing tasks that are set to be executed by your organization may be automatically assigned in bulk to any available drivers (worker state=[1,2]), optionally restricted according to team. The return value is a a json object which indicates the number of tasks assigned and a mapping of tasks to workers.

Name

Type

Description

tasks

Array

An array of task IDs to be assigned

options

Object

This field, described below, describes the constraints for the auto assignment operation.

Options Object:

Name

Type

Description

mode

string

The desired automatic assignment mode. Either distance or load.

teams

array

Optional. An array of team IDs to which workers can be selected for automatic assignment.

maxAssignedTaskCount

number

Optional. The maximum number of tasks a worker can have assigned after the automatic assignment is made.

considerDependencies

boolean

Optional. Whether to include the target task's dependency family (parent and child tasks) in the resulting assignment operation.

excludedWorkerIds

string array

Optional. One or more IDs of workers that should not be considered in assignment calculations.

restrictAutoAssignmentToTeam

boolean

Optional. This field ensure only the teams in the teams field are considered. Leaving this field out would make the teams field non-strict option. This field does not apply as an autoAssign option in Create Task

curl -X POST "https://onfleet.com/api/v2/tasks/autoAssign" \
       -u "cd3b3de84cc1ee040bf06512d233719c:" \
       -d '{"tasks": ["11z1BbsQUZFHD1XAd~emDDeK", "kc8SS1tzuZ~jqjlebKGrUmpe"], "options": {"mode": "distance", "teams": ["fwflFNVvrK~4t0m5hKFIxBUl"], "considerDependencies": true}}'
onfleet.tasks.autoAssign(body={"tasks": ["11z1BbsQUZFHD1XAd~emDDeK", "kc8SS1tzuZ~jqjlebKGrUmpe"], "options": {"mode": "distance", "teams": ["fwflFNVvrK~4t0m5hKFIxBUl"], "considerDependencies": True}})
onfleet.tasks.autoAssign({"tasks": ["11z1BbsQUZFHD1XAd~emDDeK", "kc8SS1tzuZ~jqjlebKGrUmpe"], "options": {"mode": "distance", "teams": ["fwflFNVvrK~4t0m5hKFIxBUl"], "considerDependencies": true}});
$onfleet->tasks->autoAssign(["tasks" =>  ["11z1BbsQUZFHD1XAd~emDDeK", "kc8SS1tzuZ~jqjlebKGrUmpe"], "options" =>  ["mode" =>  "distance", "teams" =>  ["fwflFNVvrK~4t0m5hKFIxBUl"], "considerDependencies" =>  true]])
{
  "assignedTasksCount":3,
  "assignedTasks"  : {
    "7z784Upb0cdm8GqPzKLVAHSI":"GPOQQjU84QPN~fP*pbunT2CW",
    "PDQyZQvaudBN7pEhLcIndjPh":"GPOQQjU84QPN~fP*pbunT2CW",
    "3flkKAFPUiQuLl5ZZ*04v41i":"GPOQQjU84QPN~fP*pbunT2CW"
  }
}