[PATCH] Custom Entities

Modified on Tue, 17 Mar at 4:31 PM

Update Custom Entity Item


This operation allows updating an existing item within a custom entity of the catalog.


It follows REST principles and aligns with the OData v4.01 standard.


[PATCH] Custom Entities Item Endpoint


/rest/Catalog/CustomEntities('{customEntityDenominator}')/item({itemId})


Making a request


  • Use the HTTP method: PATCH.
  • Include the API key in the request headers for authentication.
  • The body must be sent in JSON format with valid identifiers for each field.
  • The customEntityDenominator parameter is mandatory (name of the custom entity).
  • The itemId parameter is mandatory (ID of the item to update).


Request body example:


{
  "xxxx_title": {
    "es": "Nueva descripción del elemento",
    "en": "New item description"
  },
  "xxxx_stat": "V",
  "xxxx_image": "item_image.png",
  "xxxx_description": "Additional description of the updated item."
}


You can update one or more variant fields in the same request.


Partial Update Behavior (PATCH)


The API supports partial updates using the PATCH method.


When performing a PATCH request on a custom entity:

  • Only the fields included in the request body are modified.
  • All other fields of the entity remain unchanged.
  • Existing values for unspecified attributes are preserved.


This behavior applies to all custom-defined fields prefixed with the entity identifier, such as xxxx_.


Clearing Field Values


If a field is sent with an empty value, its content will be cleared and stored as empty.


Example:

{
  "xxxx_description": ""
}


In this case, the previous value of xxxx_description will be removed.


Clients should ensure that empty values are sent intentionally.


Response


204 No content


The custom entity item was successfully updated. No additional content is returned.


400 Bad Request


Common errors include:

  • Incorrect JSON format.
  • Invalid or missing fields.
  • Field values that do not meet constraints.


"xxxx_id not found or is invalid"


401 Unauthorized


Missing or invalid API key.


403 Forbidden


The user does not have permission to perform this operation.


404 Not Found


The specified entity or item indicated in customEntityDenominator or itemId does not exist.


412 Precondition Failed


System is not in a valid state to perform the operation.


500 Internal Server Error


Unexpected system failure


Limitations and considerations


  • Only one item per call can be updated.
  • You must provide valid and existing customEntityDenominator and itemId.
  • Bulk updates are not supported.
  • Files and images must previously exist in the system's media library.
  • All changes made are automatically recorded in the activity log (activity).


Multi-language fields support


You can include multilingual values for attributes that are configured to support multiple languages.


Multilingual body example:


{
  "xxxx_title": {
    "es": "Título del elemento personalizado en español",
    "en": "Custom entity item title in English"
  },
  "xxxx_description": {
    "es": "Descripción completa del elemento personalizado en español",
    "en": "Complete description of the custom entity item in English"
  }
}


Make sure the attribute supports multiple languages and that the languages are enabled in your account.


Multilingual field conditions


You can send multilingual values for fields only if:


  • The field is defined as multilingual in the attribute set.
  • The languages used are supported by your account.


Common errors:


  • Unsupported language → 400 - Invalid language code
  • Non-multilingual field → 400 - Attribute does not support multi-language

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article