Category Tree

It represents a hierarchical category list

Definition

A category tree represents a hierarchical category list. The category tree contains a principal node. This node can have multiple children. Each child is composed of the name and an array of localized names.

As the item schema, the category tree is versioned to be associated in a catalog.

Category Trees aren't mandatory unless you want to associate an item with a category.

Structure

Name
Type
Description

name

String

Name of the root node

tenant

String

Tenant of the account

environment

String

Environment to use

version

Int

The version of the category tree - manage by the API

localizedNames

List

List of objects providing available translations per locale:

{ "locale": "<langcode_countrycode>", "name": "<translation>" }

children

List

list of CategoryTree Category

Localized Name Structure

Name
Type
Description

name

String

Name of the category

locale

String

Based on the Java locale format <languagecode>_<countrycode>

CategoryTree Category

Name
Type
Description

name

String

Name of the root node

localizedNames

List

List of objects providing available translations per locale:

{ "locale": "<langcode_countrycode>", "name": "<translation>" }

children

List

list of CategoryTree Category

Example

{
    "name": "catalog01",
    "localizedNames": [
        {
            "locale": "en_GB",
            "name": "Home"
        },
        {
            "locale": "de_DE",
            "name": "Startseite"
        }
    ],
    "tenant": "demo",
    "environment": "fas:live1",
    "children": [
        {
            "name": "dresses21",
            "localizedNames": [
                {
                    "locale": "en_GB",
                    "name": "Dresses"
                },
                {
                    "locale": "de_DE",
                    "name": "Kleider"
                }
            ],
            "children": [
                {
                    "name": "minidresses31",
                    "localizedNames": [
                        {
                            "locale": "en_GB",
                            "name": "Mini Dresses"
                        },
                        {
                            "locale": "de_DE",
                            "name": "Minikleider"
                        }
                    ]
                },
                {
                    "name": "partydresses32",
                    "localizedNames": [
                        {
                            "locale": "en_GB",
                            "name": "Party Dresses"
                        },
                        {
                            "locale": "de_DE",
                            "name": "Partykleider"
                        }
                    ]
                }
            ]
        },
        {
            "name": "shoes22",
            "localizedNames": [
                {
                    "locale": "en_GB",
                    "name": "Shoes"
                },
                {
                    "locale": "de_DE",
                    "name": "Schuhe"
                }
            ],
            "children": [
                {
                    "name": "boots33",
                    "localizedNames": [
                        {
                            "locale": "en_GB",
                            "name": "Boots"
                        },
                        {
                            "locale": "de_DE",
                            "name": "Stiefel"
                        }
                    ]
                },
                {
                    "name": "sandals34",
                    "localizedNames": [
                        {
                            "locale": "en_GB",
                            "name": "Sandals"
                        },
                        {
                            "locale": "de_DE",
                            "name": "Sandalen"
                        }
                    ]
                },
                {
                    "name": "trainers35",
                    "localizedNames": [
                        {
                            "locale": "en_GB",
                            "name": "Trainers"
                        },
                        {
                            "locale": "de_DE",
                            "name": "Sneaker"
                        }
                    ]
                }
            ]
        }
    ]
}

Validation

Additional validation for category trees:

  • root name should not be empty or “0”

  • categories should have localized names with valid locales

  • each category name should be unique

FHR data model validation

The query parameter fhrValidation=true can be added to enforce Fredhopper specific validation to the category API. This includes the following additional checks to the schema:

  • Category names (aka Category_ids) only contain the alphanumerical characters [A-Za-z0-9] i.e. must only contain uppercase and lowercase Latin letters: A-Z, a-z, and digits: 0-9

Last updated