Skip to content

Update

Updates use JSON Patch (RFC 6902) format: an array of patch operations applied to the existing entity.

Update a Single Record

http
PATCH /api/{entity}/{id}
Content-Type: application/json-patch+json

The request body is a JSON Patch array:

http
PATCH /api/product/AB-001
Content-Type: application/json-patch+json

[
  { "op": "replace", "path": "/price", "value": 179.99 },
  { "op": "replace", "path": "/status", "value": "LOW_STOCK" }
]

Only the specified fields are modified. All other fields remain unchanged.

Response (200 OK) — the updated entity:

json
{
  "reference": "AB-001",
  "name": "Headphones",
  "price": 179.99,
  "category": { "id": 1, "name": "Electronics" },
  "status": "LOW_STOCK"
}

Supported JSON Patch Operations

OperationDescription
replaceSet a field to a new value
addAdd a value (useful for arrays)
removeRemove/null a field
copyCopy value from one path to another
moveMove value from one path to another
testVerify a field has a specific value (fails the patch if not)

Bulk Update

Update multiple records in a single request.

http
PATCH /api/{entity}
Content-Type: application/json-patch+json

The request body is a BulkPatch object:

json
{
  "ids": ["AB-001", "AB-002", "AB-003"],
  "globalPatch": [
    { "op": "replace", "path": "/status", "value": "OUT_OF_STOCK" }
  ],
  "specificPatches": {
    "AB-001": [
      { "op": "replace", "path": "/price", "value": 149.99 }
    ]
  }
}
FieldRequiredDescription
idsYesList of record IDs to update
globalPatchNoJSON Patch applied to all records in ids
specificPatchesNoMap of id → JSON Patch applied to individual records. Applied before globalPatch.

When both globalPatch and a specific patch exist for a record, the specific patch is applied first, then the global patch.

Response (200 OK) — list of all updated entities:

json
[
  { "reference": "AB-001", "price": 149.99, "status": "OUT_OF_STOCK", ... },
  { "reference": "AB-002", "status": "OUT_OF_STOCK", ... },
  { "reference": "AB-003", "status": "OUT_OF_STOCK", ... }
]

Field-Level Bulk Update Control

Use @SquizyField(bulkUpdatable = false) to prevent a field from being changed in bulk updates:

java
@SquizyField(bulkUpdatable = false)
private String reference;

See Bulk Operations for more details on field-level configuration.

Access Control

Requires the update authority for the entity. See RBAC.