Category Tree Resources

Read Category Trees

Deprecated

Retrieving a category tree

get

Retrieves a category tree.

Note: By default, only published categories are retrieved.


Required scopes:

No specific scopes are required.

Authorizations
Path parameters
tenantstring · min: 3 · max: 16Required

Your Emporix tenant's name.

Note: The tenant should always be written in lowercase.

Pattern: ^[a-z][a-z0-9]{2,15}$
Responses
200
The request was successful. The category tree is returned.
application/json
get
GET /category/{tenant}/categories/categoryTree HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
{
  "id": "38118",
  "name": "ProductRoot",
  "code": "productroot",
  "description": "{\"type\":\"ProductRoot\"}",
  "position": 55555,
  "published": true,
  "subcategories": [
    {
      "id": "38119",
      "parentId": "38118",
      "name": "Fruits & Vegetables",
      "code": "fruits-&-vegetables",
      "description": "Fresh and tasty fruits and vegetables.",
      "position": 0,
      "published": true,
      "subcategories": [
        {
          "id": "38120",
          "parentId": "38119",
          "name": "Fruit",
          "code": "fruit",
          "position": 0,
          "published": true
        }
      ]
    }
  ]
}

Retrieving the category trees

get

Retrieves the category trees.


Required scopes

  • category.category_read_unpublished

    Note: Only required if the response should contain unpublished categories.

Authorizations
Path parameters
tenantstringRequired

Your Emporix tenant's name.

Note: The tenant should always be written in lowercase.

Example: saasdev2
Query parameters
showUnpublishedbooleanOptional

If set to true, not published categories are retrieved as well. Possible values:

  • true
  • false Note: To get unpublished categories you need to have category.category_read_unpublished scope.
Default: falseExample: true
Header parameters
X-VersionstringRequired

To use this endpoint you have to add X-Version header with proper value to your request.

Note: The header value has to match following regular expression: ^v[1-9][0-9]?$

Example: v2Pattern: ^v[1-9][0-9]?$
Responses
200
The request was successful. The category tree is returned.
application/json
get
GET /category/{tenant}/category-trees HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
X-Version: v2
Accept: */*
[
  {
    "id": "46124ba108-e6fd-4139-b831-5ac5fded6d52",
    "localizedName": {
      "en": "ProductRoot"
    },
    "code": "productroot",
    "localizedSlug": {
      "en": "productroot"
    },
    "localizedDescription": {
      "en": "ProductRoot"
    },
    "position": 55555,
    "published": true,
    "subcategories": [
      {
        "id": "12a24ba108-e6fd-4139-b831-5ac5fded6d34",
        "parentId": "46124ba108-e6fd-4139-b831-5ac5fded6d52",
        "localizedName": {
          "en": "Fruits & Vegetables"
        },
        "code": "fruits-&-vegetables",
        "localizedSlug": {
          "en": "fruits-&-vegetables"
        },
        "localizedDescription": {
          "en": "Fresh and tasty fruits and vegetables."
        },
        "position": 0,
        "published": true,
        "subcategories": [
          {
            "id": "12a24ba108-e6fd-4139-b831-5ac5fded6d34",
            "parentId": "34a24ba108-e6fd-4139-b831-5ac5fded6dae",
            "localizedName": {
              "en": "Fruit"
            },
            "code": "fruit",
            "localizedSlug": {
              "en": "fruit"
            },
            "position": 0,
            "published": true
          }
        ]
      }
    ]
  }
]

Retrieving a specific category tree

get

Retrieves a category tree for a root category with a given id.

Note: You can retrieve a category tree only for a root category. It is not possible to get a category tree for a category that lies lower in the hierarchy.


Required scopes

  • category.category_read_unpublished

    Note: Only required if the response should contain unpublished categories.

Authorizations
Path parameters
tenantstringRequired

Your Emporix tenant's name.

Note: The tenant should always be written in lowercase.

Example: saasdev2
categoryIdstringRequired

A unique identifier of a root category, generated when the category is created.

Example: 12a24ba108-e6fd-4139-b831-5ac5fded6d34
Query parameters
showUnpublishedbooleanOptional

If set to true, not published categories are retrieved as well. Possible values:

  • true
  • false Note: To get unpublished categories you need to have category.category_read_unpublished scope.
Default: falseExample: true
Header parameters
X-VersionstringRequired

To use this endpoint you have to add X-Version header with proper value to your request.

Note: The header value has to match following regular expression: ^v[1-9][0-9]?$

Example: v2Pattern: ^v[1-9][0-9]?$
Responses
200
The request was successful. The category tree is returned.
application/json
get
GET /category/{tenant}/category-trees/{categoryId} HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
X-Version: v2
Accept: */*
{
  "id": "46124ba108-e6fd-4139-b831-5ac5fded6d52",
  "localizedName": {
    "en": "ProductRoot"
  },
  "code": "productroot",
  "localizedSlug": {
    "en": "productroot"
  },
  "localizedDescription": {
    "en": "ProductRoot"
  },
  "position": 55555,
  "published": true,
  "subcategories": [
    {
      "id": "12a24ba108-e6fd-4139-b831-5ac5fded6d34",
      "parentId": "46124ba108-e6fd-4139-b831-5ac5fded6d52",
      "localizedName": {
        "en": "Fruits & Vegetables"
      },
      "code": "fruits-&-vegetables",
      "localizedSlug": {
        "en": "fruits-&-vegetables"
      },
      "localizedDescription": {
        "en": "Fresh and tasty fruits and vegetables."
      },
      "position": 0,
      "published": true,
      "subcategories": [
        {
          "id": "12a24ba108-e6fd-4139-b831-5ac5fded6d34",
          "parentId": "34a24ba108-e6fd-4139-b831-5ac5fded6dae",
          "localizedName": {
            "en": "Fruit"
          },
          "code": "fruit",
          "localizedSlug": {
            "en": "fruit"
          },
          "position": 0,
          "published": true
        }
      ]
    }
  ]
}

Was this helpful?