Update an existing dispatch
This API only accepts a JSON object in the body of the request and is used to update an existing dispatch. The JSON object should take the general form illustrated in this example. This is an example of a dispatch with no stops and no trips. If we PUT
request the following JSON, we'll get the response above.
{
"vendor_id":"VD-1",
"dispatch_stops":[
{
"vendor_id":"VBS-2",
"type":"delivery",
"number":1,
"form_ids":[
"be4cd651-5aca-436b-8cf3-e7881c3d76b8",
"e93b8563-53cc-4318-b957-369b5fda18d0"
],
"dispatch_location_id":8387
}
],
"dispatch_trips":[
{
"vendor_id":"VT-2",
"vehicle_id":2597,
"driver_id":4806,
"vendor_stop_ids":[
"VSS-1",
"VBS-2",
"VDS-1"
],
"status":"not_started"
}
]
}
To update an existing dispatch just send the entire dispatch again with updated information to this API. To remove a dispatch stop or trip (additional stop/trip) just send the entire dispatch again without the information for the dispatch stop/trip created before. You can simply pass a {vendor_id: XYZ} for a dispatch stop/trip in the dispatch trips/stops array to persist the trip/stop through API calls.
Sample Requests
{
"vendor_id":"VD-1",
"dispatch_stops":[
{
"vendor_id":"VBS-2"
}
],
"dispatch_trips":[
{
"vendor_id":"VT-2",
"status":"cancelled"
}
]
}
To cancel a dispatch it is recommended to not change the status of the Dispatch to cancelled but rather just cancel the underlying Dispatch Trip for the Dispatch. If there are multiple trips for a Dispatch then all trips need to be cancelled for the overall Dispatch to be cancelled.