Skip to main content
Skip to Content
Dispatch API
This is the documentation for Dispatch API v0.2b, which is no longer actively maintained. For up-to-date documentation, see the latest version (v1.0).

Optimize a plan

POST
/plans/{planId}:optimize

The playground uses your live account

Requests are sent with your real API key, so creating, updating or deleting here changes your production data.

Optimize a 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.

Authorization

BasicAuth
headerAuthorizationBasic <token>

Use the API key as the username and leave the password empty.

Path Parameters

planId*string

The plan id

Match^[a-zA-Z0-9---_]{1,50}$

Response Body

The created plan_optimization operation.

application/json
  1. response

The created plan_optimization operation.

id*string

The 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*boolean

Whether the operation is done.

metadata*

Metadata related to a plan optimization operation.

result*||

The result of the plan optimization operation, or an error.

Example Request
curl -X POST 'https://api.spoke.com/public/v0.2b/plans/string:optimize'
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"      }    ]  }}