Create a new task with the same details of an existing 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.
| Name | Type | Description |
|---|---|---|
| options | object | This 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.
| Name | Type | Description |
|---|---|---|
| includeMetadata | boolean | If true, metadata will be included on the cloned task. |
| includeBarcodes | boolean | If true, bar codes will be included on the cloned task. |
| includeDependencies | boolean | If true, the dependencies will be included on the cloned task. |
| overrides | object | This 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 "<your_api_key>:"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": []
}
}