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.

NameTypeDescription
tasksArrayAn array of task IDs to be assigned
optionsObjectThis field, described below, describes the constraints for the auto assignment operation.

Options Object:

NameTypeDescription
modestringThe desired automatic assignment mode. Either distance or load.
teamsarrayOptional. An array of team IDs to which workers can be selected for automatic assignment.
maxAssignedTaskCountnumberOptional. The maximum number of tasks a worker can have assigned after the automatic assignment is made.
considerDependenciesbooleanOptional. Whether to include the target task's dependency family (parent and child tasks) in the resulting assignment operation.
excludedWorkerIdsstring arrayOptional. One or more IDs of workers that should not be considered in assignment calculations.
restrictAutoAssignmentToTeambooleanOptional. 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"
  }
}