Skip to main content
Skip to Content
Dispatch API

On Update endpoints (HTTP PATCH verb)

Update methods differ from the other methods in the API in the sense that missing values in the JSON representation will not act upon the representation of the resource.

Explaining this by example: Suppose you have a Plan with the ID plan1 in your plans' collection, and you wanted to merely update its title to My API Plan without changing other information, such as assigned drivers or the start date. To do this you would issue the following request:

curl -X PATCH http://localhost:5005/public/v1/plans/plan1 -H 'Content-type: application/json' -d '{"title": "My API Plan"}' -u yourApiKey:

Notice how we don't pass any other information in the JSON, only the title. This ensures that the PATCH request will only operate on the provided parameters and keep the other parameters as-is.

It is important to also notice that when updating an array the whole array will be replaced, Spoke API does not support partial updates on arrays.