November 18, 2020

Partial Order Update

With the PUT method for order update, we have to send the full representation of the resource even when we need to modify a single field. Unlike the PUT method PATCH method allows updating order with the partial payload. The partial update is implemented according to JSON Merge Patch standard proposed in RFC 7396.

In order to perform the partial update, you should send a payload with a set of fields that needs to be updated. The content type of the request should be application/merge-patch+json. Field values that are included in the payload replace old values. Fields that aren’t included in the payload remain untouched.

Notice that according to the standard it is not possible to patch part of an array. For example, if you send a nested vehicles array field in a payload, the vehicle list in the order will be completely overwritten by the content of this array.

The following example demonstrates a partial update of price, pickup.scheduled_at, and delivery.scheduled_at fields:

        "price": 123.99,
        "pickup": {
            "scheduled_at": "2020-12-22T10:33:29.112+0000"
        "delivery": {
            "scheduled_at": "2020-12-28T10:33:29.112+0000"

Please, see details on how to use the HTTP PATCH method for partial order update from the API reference.