[PATCH] Categories

Modified on Tue, 17 Mar at 4:23 PM

Update Category


This operation allows you to update an existing category within the catalog.


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


[PATCH] Categories Endpoint


https://api2.saleslayer.com/rest/Catalog/Categories({categoryId})


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 categoryId parameter is mandatory. Identifier of the category to be updated.


Request body example:


{
  "cat_title": {
    "es": "Zapatos Deportivos",
    "en": "Sports Shoes"
  },
  "cat_parent_id": 3,
  "cat_stat": "V",
  "cat_description": "Categoría dedicada exclusivamente al calzado deportivo.",
  "cat_image": "zapatos_deportivos.png"
}


You can update one or more category fields at a time. Editing the cat_ref, cat_id, cat_creation, cat_parent_ref, or cat_parent_path fields is not permitted, as these are auto-generated or auto-managed fields.


Response


204 No content


The category was updated successfully. No content is returned.


400 Bad Request


Common errors include:

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


"cat_parent_id does not exist or is invalid"


401 Unauthorized


Missing or invalid API key.


403 Forbidden


User does not have permission to create variants.


404 Not Found


The category specified in categoryId 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 category per call.
  • You must provide a valid, existing categoryId.
  • Batch updates are not supported.
  • Files and images must already exist in the library.
  • Circular references are not allowed (a category cannot have a direct or indirect descendant as a parent).
  • All changes made are automatically recorded in the activity.


Multi-language fields support


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


Multilingual body example:


{
  "cat_title": {
    "es": "Calzado Urbano",
    "en": "Urban Footwear"
  }
}


?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


Partial Update Behavior (PATCH)


When performing a PATCH request on a category:

  • Only the fields included in the request body are modified.
  • All other category fields remain unchanged.


Example:

{
  "cat_ref": "NEW-CATEGORY-REF"
}


Only cat_ref will be updated. All other category fields, such as cat_title and cat_description, will remain unchanged.


Clearing Field Values


Example:

{
  "cat_description": ""
}


The category description will be cleared and stored as empty.

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