Skip to content
Last update: June 16, 2025

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, or test):

    • 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.
    • 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 an add.
    • move: Moves a value from from to path. The original value is removed.
    • copy: Copies a value from from to path without removing the original.
    • test: Asserts that the value at path matches value. 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 (for add, replace, and test operations).
  • from: The source location (for move and copy operations).
Example
[
  { "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.

Readmore JSON‑Patch in ASP.NET Core

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
CatalogUpdate catalogPATCH /api/catalog/catalogs/{id}
Update categoryPATCH /api/catalog/categories/{id}
Update product configurationPATCH /api/catalog/products/configurations/{id}
Update measurePATCH /api/catalog/measures/{id}
Update productPATCH /api/catalog/products/{id}
Update propertyPATCH /api/catalog/properties/{id}
Update product associationPATCH /api/catalog/products/associations/{id}
Update dictionary itemPATCH /api/catalog/dictionaryitems/{id}
Update product videoPATCH /api/catalog/videos/{id}
PricingUpdate price assignmentPATCH /api/pricing/assignments/{id}
Update product pricePATCH /api/products/prices/{id}
Update pricelistPATCH /api/pricing/pricelists/{id}
StoreUpdate storePATCH /api/stores/{id}
InventoryUpdate fulfillment centerPATCH /api/inventory/fulfillmentcenters/{id}
Update inventoryPATCH /api/inventory/{id}
CartUpdate cartPATCH /api/carts/patch{id}
Update cart itemPATCH /api/carts/patch/{cartId}/items/{lineItemId}
Update cart paymentPATCH /api/carts/patch{cartId}/payments/{paymentId}
Update cart shipmentPATCH /api/carts/patch{cartId}/shipments/{shipmentId}
OrderUpdate customer orderPATCH /api/order/customerOrders/{id}
Update order paymentPATCH /api/order/payments/{id}
Update order shipmentPATCH /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):

    [
      {
        "op": "replace",
        "path": "/middleName",
        "value": "Michel"
      }
    ]
    
  • Add a phone number to the beginning of the phones array (index 0 appends at front):

    [
      {
        "op": "add",
        "path": "/phones/0",
        "value": "+19995558545"
      }
    ]
    
  • Remove a phone number (delete index 1):

    [
      {
        "op": "remove",
        "path": "/phones/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:

    [
      {
        "op": "move",
        "from": "/tempField",
        "path": "/finalField"
      }
    ]
    

Readmore JSON Patch Builder Online