For the complete documentation index, see llms.txt. This page is also available as Markdown.

Create a category node

Creates a category node.

name is the only field the API enforces as required. Supplying parent files the node under that parent as its first child, or immediately after prev_sibling when one is given; a prev_sibling sent without a parent is silently ignored. See Tree Structure & Positioning in the section description.

Important: although the API does not mark uuid as required, the create service cannot run without it. Omitting uuid produces an unhandled server error (HTTP 500), not a 400. Always send a uuid. A uuid that is already in use is reported properly, as a 400 on the uuid field.

Important: create persists only name, uuid, the position given by parent / prev_sibling, and localized_attributes. attributes, attributes_kwargs, localized_attributes_kwargs, and sort_option are accepted and validated but not stored — send them in a follow-up PATCH /category_node/{id}/.

Creating a tree root. Omitting parent makes the node a new tree root, which also requires creating a root menu item for the storefront navigation. Only one visible root menu item may exist, so on a deployment that already has a storefront menu this is rejected with 406 and error_code: menu_item_200, and nothing is created. Integrations normally create nodes under an existing parent.

Side effects. A successful create adds a matching menu item to the storefront navigation and generates a pretty URL from the node's name. Of the pretty-URL failures, only a generated path that resolves to / (pretty_url_100_6) is logged and ignored — the node is still created, with absolute_url falling back to the default /category/{pk}/ route. Any other pretty-URL failure (pretty_url_100_1, pretty_url_100_2, pretty_url_100_3) is rejected with 406 and the node is not created. The shape of the generated URL depends on the PRETTY_URL_INCLUDE_DEFAULT_LANGUAGE dynamic setting and on the pretty-URL deployment settings listed under Dynamic Settings & Environment Variables.

post
/category_node/
Authorizations
AuthorizationstringRequired

Token credential sent in the Authorization header, in the form: Token <your-token>. Requires a staff (admin) account.

Body

The body of a category node create or update request.

On create only name, uuid, parent / prev_sibling, and localized_attributes are persisted; attributes, attributes_kwargs, localized_attributes_kwargs, and sort_option are accepted but ignored. On update every field below is honored, and fields left out keep their current value — a PUT is not a replacement, it differs from a PATCH only in requiring name.

namestring · max: 64Required

The display name of the node. Stored as the value of the deployment's default language; translations go in localized_attributes.

uuidstring · uuidOptional

The client-supplied unique identifier. Not enforced as required by the API, but the create service cannot run without it — omitting it on POST produces an unhandled server error (HTTP 500) rather than a 400, so always send it on create. Must be unique across all category nodes; a duplicate is reported as a 400. Optional on update.

parentintegerWrite-onlyOptional

The identifier of the node to file this node under. Omit on create to make the node a new tree root. On update, moves the node and its entire subtree under this parent as its first child — but is silently ignored when prev_sibling is also sent.

prev_siblingintegerWrite-onlyOptional

The identifier of the sibling this node should be placed immediately after. Ignored on create when no parent is given. On update it takes precedence over parent; send it to keep the node's position among its siblings, since without it the node is moved to the front of the list.

sort_optioninteger · nullableOptional

The identifier of the sort option used as the default ordering of the node's category page. Ignored on create.

Responses
201

The created category node.

application/json

A category node of the catalog category tree.

pkintegerRead-onlyOptional

The unique identifier of the node.

namestring · max: 64Optional

The display name of the node, rendered in the language selected for the request.

uuidstring · uuidOptional

The client-supplied unique identifier of the node.

depthintegerRead-onlyOptional

The node's level in the tree, starting at 1 for a tree root.

pathstring · max: 255Read-onlyOptional

The node's materialized path — one step of exactly 4 base-36 characters (0-9A-Z) per tree level, e.g. 0001 for a root and 00010002 for a child of it. A node and its descendants are exactly the records whose path starts with this value. Use it for prefix matching only; never parse a step as a decimal number.

absolute_urlstringRead-onlyOptional

The storefront path of the node's category page — its pretty URL when one exists, otherwise the default /category/{pk}/ route (language-prefixed on deployments that enable I18N_ACTIVE).

menuitemmodelstring · nullableRead-onlyOptional

The uuid of the menu item mirroring this node in the storefront navigation, or null when the node has no menu item.

sort_optioninteger · nullableOptional

The identifier of the sort option used as the default ordering of the node's category-page product listing, applied only when the visitor has not chosen an explicit sort.

post/category_node/
POST /api/v1/remote/1/category_node/ HTTP/1.1
Host: sandbox.akinon.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 141

{
  "name": "Shoes",
  "uuid": "9f1c2e7a-4b8d-4f3a-9c11-2d6e8b7a0f45",
  "parent": 7,
  "prev_sibling": 41,
  "localized_attributes": {
    "de": {
      "l_name": "Schuhe"
    }
  }
}
{
  "pk": 42,
  "name": "Shoes",
  "menuitemmodel": "3f2a1c9e-8b7d-4a6f-9c0e-1d2b3a4c5e6f",
  "absolute_url": "/shoes/",
  "sort_option": 3,
  "uuid": "9f1c2e7a-4b8d-4f3a-9c11-2d6e8b7a0f45",
  "depth": 2,
  "path": "00010002",
  "attributes": {
    "size_chart": {
      "value": 12,
      "kwargs": {
        "label": "Women's Shoes"
      }
    }
  }
}

Last updated

Was this helpful?