Category Management¶
A category is a way of defining common schema (and optionally, attribute values) for a group of products instead of having to define them at a product level.
Defining a category for products is not mandatory, but recommended.
Schema Object¶
A schema object defines the schema to be followed by a product or a category.
This puts restrictions on possible values of the attributes. For example, in a
schema, you may want to keep product_sku
as unique for all products in a
category.
-
schemaObject
¶ -
unique
¶ This is a list of attribute groups that should be unique. See below for examples.
-
type
¶ This is a string with a constant value
"object"
.
-
Examples of schema¶
product_sku
should be unique
{ "unique": [ ["product_sku"] ], "type": "object" }
Combination of
product_sku
andclient_id
should be unique{ "unique": [ [ "product_sku", "client_id" ] ], "type": "object" }
Combination of
product_sku
andclient_id
should be unique andql_code
should also be unique{ "unique": [ [ "product_sku", "client_id" ], [ "ql_code" ] ], "type": "object" }
Category Object¶
Catagory object represents the schema and common attributes for all products defined under that category.
-
categoryObject
¶ -
clientCatalogId
¶ This is a string representing the id of the catalog this category belongs to.
-
clientCategoryId
¶ This is a string representing the unique id of this category.
-
description
¶ This is an optional string description of the category.
-
schema
¶ This is a Schema Object that defines the schema that this category’s products will follow.
-
categoryAttributes
¶ This is an object which can hold arbitrary key-value pairs related to this category.
-
attributes
¶ optional
This is an object which can hold arbitrary key-value pairs which will automatically copied down as attributes of the products under this category, unless overridden at the product level.
-
Category Sample JSON¶
{
"clientCategoryId": "1",
"clientCatalogId": "10",
"description": "Category description",
"schema": {
"unique": [
[
"product_sku",
"client_id"
]
],
"type": "object"
},
"categoryAttributes": {
"attr1": "value1",
"attr2": "value2"
},
"attributes": {
"status": "ACTIVE"
}
}