v1

latestSwagger 2.02026-07-13137761.0 MB
Category

Update/create a category

This endpoint allows you to update a given category. Know more about <a href="/documentation/update.html#update-behavior">Update behavior</a>. Note that if no category exists for the given code, it creates it.

patch/api/rest/v1/categories/{code}

Path parameters

codestring required

Code of the resource

Request body

codestring required

Category code

parentstring

Category code of the parent's category

updatedstring dateTime

Date of the last update

positioninteger

Position of the category in its level, start from 1 (only available since the 7.0 version and when query parameter "with_position" is set to "true")

channel_requirementsstring[]

List of <a href='api-reference-paas.html#Channel'>Channel</a> codes on which the category is required for products completeness. Only category trees can be required, not child categories.

Example request

{
  "code": "winter_collection",
  "parent": null,
  "labels": {
    "en_US": "Winter collection",
    "fr_FR": "Collection hiver"
  },
  "values": [
    {
      "data": "<p>Winter collection description</p>",
      "channel": "ecommerce",
      "locale": "en_US",
      "attribute_code": "a_text_area_attribute"
    },
    {
      "data": false,
      "channel": "ecommerce",
      "locale": null,
      "attribute_code": "a_boolean_attribute"
    },
    {
      "data": null,
      "channel": null,
      "locale": null,
      "attribute_code": "an_image_attribute"
    }
  ],
  "validations": {
    "max_categories_per_product": 42,
    "only_leaves": false,
    "is_mandatory": true
  },
  "channel_requirements": [
    "ecommerce",
    "mobile"
  ]
}

Response

Created