Partial Update for Entities in the Top Modules Using PATCH Endpoint¶
According to the RFC-6902 specification, REST API methods allow updating individual entity fields avoiding unintentionally overwriting data and make API calls more efficient and safer.
.Net Core has its own implementation of this specification and allows you to implement similar approaches to updating entities out of the box.
There are also special free online update request constructors according to the specified specification.
Developers integrating with the Virto Commerce API can update only specific fields in entities in different modules of the Platform.
JSON patches¶
A patch document is a JSON array of operations, where each operation includes:
-
op
: The operation to perform (add
,remove
,replace
,move
,copy
, ortest
):-
add: Inserts a value at the target location.
- If the target is an array:
- Inserting at an index equal to the array’s current length appends the value.
- Inserting beyond the length returns a 400 Bad Request.
- If the target is a non-array field,
add
creates or replaces the value.
- If the target is an array:
-
remove: Deletes the value at the target location. For arrays, the element at the given index is removed, and following elements shift left.
- replace: Replaces the value at the target location. Equivalent to a
remove
followed by anadd
. - move: Moves a value from
from
topath
. The original value is removed. - copy: Copies a value from
from
topath
without removing the original. - test: Asserts that the value at
path
matchesvalue
. If the test fails, the patch is aborted with 400 Bad Request.
-
-
path
: A JSON pointer indicating the target location in the document. value
: The new value (foradd
,replace
, andtest
operations).from
: The source location (formove
andcopy
operations).
[
{ "op": "add", "path": "/newField", "value": "New value" },
{ "op": "remove", "path": "/oldField" },
{ "op": "replace", "path": "/existingField", "value": "Updated value" },
{ "op": "move", "from": "/tempField", "path": "/finalField" },
{ "op": "copy", "from": "/sourceField", "path": "/destinationField" },
{ "op": "test", "path": "/testField", "value": "Expected value" }
]
Only the fields included in your request body will be modified; omitted fields remain unchanged.
Supported endpoints¶
The following table outlines the supported PATCH
endpoints across Virto Commerce modules, along with example request paths for each.
Module | API Endpoint | Example |
---|---|---|
Catalog | Update catalog | PATCH /api/catalog/catalogs/{id} |
Update category | PATCH /api/catalog/categories/{id} | |
Update product configuration | PATCH /api/catalog/products/configurations/{id} | |
Update measure | PATCH /api/catalog/measures/{id} | |
Update product | PATCH /api/catalog/products/{id} | |
Update property | PATCH /api/catalog/properties/{id} | |
Update product association | PATCH /api/catalog/products/associations/{id} | |
Update dictionary item | PATCH /api/catalog/dictionaryitems/{id} | |
Update product video | PATCH /api/catalog/videos/{id} | |
Pricing | Update price assignment | PATCH /api/pricing/assignments/{id} |
Update product price | PATCH /api/products/prices/{id} | |
Update pricelist | PATCH /api/pricing/pricelists/{id} | |
Store | Update store | PATCH /api/stores/{id} |
Inventory | Update fulfillment center | PATCH /api/inventory/fulfillmentcenters/{id} |
Update inventory | PATCH /api/inventory/{id} | |
Cart | Update cart | PATCH /api/carts/patch{id} |
Update cart item | PATCH /api/carts/patch/{cartId}/items/{lineItemId} | |
Update cart payment | PATCH /api/carts/patch{cartId}/payments/{paymentId} | |
Update cart shipment | PATCH /api/carts/patch{cartId}/shipments/{shipmentId} | |
Order | Update customer order | PATCH /api/order/customerOrders/{id} |
Update order payment | PATCH /api/order/payments/{id} | |
Update order shipment | PATCH /api/order/shipments/{id} |
Response codes¶
- 204 No Content: Update succeeded.
- 400 Bad Request: Invalid payload (e.g., malformed JSON, invalid JSON‑Pointer syntax).
- 403 Forbidden: Insufficient permissions (see your API permissions guide).
- 404 Not Found: No entity found with the specified ID.
Examples¶
-
Update a single field (replace the Member’s middle name):
-
Add a phone number to the beginning of the
phones
array (index 0 appends at front): -
Remove a phone number (delete index 1):
-
Add an address object at index 1 of the
addresses
array:[ { "op": "add", "path": "/addresses/1", "value": { "addressType": "BillingAndShipping", "line1": "c/ Eucaliptus 10", "line2": "pta. 10", "city": "Valencia", "postalCode": "44375", "countryCode": "ESP", "firstName": "John", "lastName": "Doe", "email": "[email protected]", "isDefault": false } } ]
-
Move a temporary field into its final location: