Updating via Patch Document

The interworks.cloud Platform API supports partial updates of all entities via the HTTP PATCH methods that support JSON Patch (http://jsonpatch.com).

Given an entity, e.g. an Account, we can specify a JSON Patch document containing the changes to perform.

The entity’s attributes that could be used for partial updates are usually the same as the ones required for the creation of the entity, e.g. the accountPostDto model for POST /api/accounts.

For example, the following JSON Patch document can be used for the PATCH /api/accounts/{accountId} method, to update the account name and ordering enabled attribute (add and replace operations have the same impact here).

[
  {
    "op": "add",
    "path": "/name",
    "value": "Barry"
  },
  {
    "op": "replace",
    "path": "/orderingEnabled",
    "value": "true"
  }
]

Another example given below resets the credit limit of the account to its default value (0) using the remove operation.

[
  {
    "op": "remove",
    "path": "/creditLimit"
  }
]