Re-optimize a plan
POST
The playground uses your live account
Requests are sent with your real API key, so creating, updating or deleting here changes your production data.
Re-optimize a plan. This endpoint should be used only after updating a live plan. Returns the created operation, which can be polled for the result. Use the returned id with the operations endpoints to poll for the result.
BasicAuthheader
AuthorizationBasic <token>Use the API key as the username and leave the password empty.
planId*stringThe plan id
Match
^[a-zA-Z0-9---_]{1,50}$The request body for reoptimize a plan.
application/json- body
The request body for reoptimize a plan.
optimizationType?stringThe type of optimization to use
Default
"reorder_changed_stops"Value in
"reorder_changed_stops""reorder_all_stops""redistribute_stops_between_drivers"The created plan_optimization operation.
application/json- response
The created plan_optimization operation.
id*stringThe id of the operation, in the format operations/<id>.
Match
^operations\/[a-zA-Z0-9---_]{1,50}$type*"plan_optimization"Value in
"plan_optimization"done*booleanWhether the operation is done.
metadata*Metadata related to a plan optimization operation.
result*||The result of the plan optimization operation, or an error.
curl -X POST 'https://api.spoke.com/public/v1/plans/string:reoptimize' \ -H 'Content-Type: application/json' \ -d '{}'Example Response
{ "id": "string", "type": "plan_optimization", "done": true, "metadata": { "canceled": true, "startedAt": 0, "finishedAt": null, "startedBy": "dispatcher", "targetPlanId": "string" }, "result": { "numOptimizedStops": 0, "skippedStops": [ { "id": "string", "reason": "impossible_time_window" } ] }}