Clone task

Clone task

The property sourceTaskId can be used to keep track of the source task from which the task was cloned. The clone API endpoint takes a single optional parameter on the request body called options.

NameTypeDescription
optionsobjectThis object allows you to modify the behavior of the cloning function. See the allowed properties below.

The available fields within the options parameter are defined in the below table.

NameTypeDescription
includeMetadatabooleanIf true, metadata will be included on the cloned task.
includeBarcodesbooleanIf true, bar codes will be included on the cloned task.
includeDependenciesbooleanIf true, the dependencies will be included on the cloned task.
overridesobjectThis object allows you to override certain values on the cloned task. The available fields to override are:

destination: A destination id or object.

recipients: An array of recipient objects or an array of recipient ids.

notes: A string which holds notes for the cloned task

pickupTask: A boolean which will mark the task as a pick up or drop off task

serviceTime: A number which indicates the service time

metadata: An array of metadata objects

completeAfter: A timestamp which must be in the future

completeBefore: A timestamp which must be in the future and after the completeAfter if defined.
curl -X POST "https://onfleet.com/api/v2/tasks/uO2vKr07h6zg7Fzf~2NC3KLg/clone" \
     -u "c64f80ba83d7cfce8ae74f51e263ce93:"
onfleet.tasks.clone(id="uO2vKr07h6zg7Fzf~2NC3KLg")
onfleet.tasks.clone("uO2vKr07h6zg7Fzf~2NC3KLg");
$onfleet->tasks->clone("uO2vKr07h6zg7Fzf~2NC3KLg")
{
  "id": "fesYPEu2FWvubaq~2nof*lCA",
  "timeCreated": 1489010058000,
  "timeLastModified": 1489010058477,
  "organization": "yAM*fDkztrT3gUcz9mNDgNOL",
  "shortId": "9b4zd53d",
  "trackingURL": "https://onf.lt/9b4zd53d",
  "worker": null,
  "merchant": "yAM*fDkztrT3gUcz9mNDgNOL",
  "executor": "yAM*fDkztrT3gUcz9mNDgNOL",
  "creator": "EJmsbJgHiRLPjNVE7GEIPs7*",
  "dependencies": [],
  "state": 0,
  "completeAfter": null,
  "completeBefore": null,
  "pickupTask": false,
  "notes": "",
  "completionDetails": {
    "events": [],
    "failureReason": "NONE",
    "time": null
  },
  "feedback": [],
  "metadata": [],
  "overrides": {},
  "quantity": 0,
  "serviceTime": 0,
  "delayTime": null,
  "sourceTaskId": "uO2vKr07h6zg7Fzf~2NC3KLg",
  "container": {
    "type": "ORGANIZATION",
    "organization": "yAM*fDkztrT3gUcz9mNDgNOL"
  },
  "recipients": [],
  "destination": {
    "id": "Fa0Oxd21cL3T36qw5mGOvZw6",
    "timeCreated": 1485469374000,
    "timeLastModified": 1485469374734,
    "location": [
      -122.43232727050781,
      37.79811961477822
    ],
    "address": {
      "apartment": "",
      "state": "California",
      "postalCode": "94123",
      "country": "United States",
      "city": "San Francisco",
      "street": "Buchanan Street",
      "number": "3020"
    },
    "notes": "",
    "metadata": []
  }
}