[GET] Categories and Metada

Categories Overview

The Categories resource provides information about product categories and their relationships with other entities, such as Products and Variants. Using the metadata and endpoints described here, you can query, filter, and navigate through category data efficiently.

Metadata

The metadata is a JSON schema document that describes all resources within the Categories entity and their relationships to other entities. This metadata can be used to construct queries for the API and to understand the structure of related entities.

Key Details about Metadata

  • When requesting metadata for a table, you also receive metadata for its related tables (e.g., Products, and Variants).
  • The metadata is essential for understanding which fields can be queried and expanded.

[GET] Categories Metadata Endpoint

https://api2.saleslayer.com/rest/Catalog/Categories/$metadata

Making a request

To make a request to our API, you will need to use the appropriate method (GET), endpoint URL and include the API key in the request headers for authentication.

Receiving a response

When you make a request to our API, you will receive a response in the form of a JSON object. This object will contain the data requested, as well as any relevant metadata such as status codes and error messages.

{
  "value": [
    {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "$id": "/metadata/9587/Category/1.0.0.0",
      "type": "object",
      "title": "Category",
      "description": "Category metadata definition",
      "default": {
        "culture": "en"
      },
      "properties": {
        "cat_ref": {
          "title": "Category Reference",
          "type": "string"
        },
        "cat_title": {
          "title": "Category name",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "object",
            "properties": {
              "culture": {
                "type": "string",
                "enum": [
                  "de",
                  "en",
                  "en-us",
                  "es",
                  "fr"
                ],
                "default": "en"
              },
              "value": {
                "type": "string"
              }
            },
            "required": [
              "culture"
            ]
          }
        },
        "cat_parent_ref": {
          "title": "Parent Category Reference",
          "type": [
            "string",
            "null"
          ]
        },
        "Products": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "/metadata/9587/Product/1.0.0.0"
          }
        }
      },
      "required": [
        "cat_ref"
      ]
    },
    {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "$id": "/metadata/9587/Product/1.0.0.0",
      "type": "object",
      "title": "Product",
      "description": "Product metadata definition",
      "default": {
        "culture": "en"
      },
      "properties": {
        "prod_ref": {
          "title": "prod_ref",
          "type": [
            "string",
            "null"
          ]
        },
        "prod_title": {
          "title": "prod_name",
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "culture": {
                "type": "string",
                "enum": [
                  "de",
                  "en",
                  "en-us",
                  "es",
                  "fr"
                ],
                "default": "en"
              },
              "value": {
                "type": "string"
              }
            },
            "required": [
              "culture"
            ]
          }
        },
        "cat_ref": {
          "title": "Category Reference",
          "type": [
            "string",
            "null"
          ]
        },
        "Variants": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "/metadata/9587/Variant/1.0.0.0"
          }
        },
        "AttributeSets": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "/metadata/9587/AttributeSet/1.0.0.0"
          }
        }
      },
      "required": [
        "prod_title"
      ]
    },
    {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "$id": "/metadata/9587/Variant/1.0.0.0",
      "type": "object",
      "title": "Variant",
      "description": "Variant metadata definition",
      "default": {
        "culture": "en"
      },
      "properties": {
        "frmt_stat": {
          "title": "Status",
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "V",
            "I",
            "D",
            "R"
          ],
          "default": "R"
        },
        "prod_ref": {
          "title": "var_prod_ref",
          "type": [
            "string",
            "null"
          ]
        },
        "frmt_ref": {
          "title": "Variant Reference",
          "type": "string"
        },
        "frmt_tags": {
          "title": "Tags",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "frmt_ref"
      ]
    }
  ],
  "readLink": {
    "uri": "https://api2.saleslayer.com/rest/Catalog/Categories/$metadata?=cat_ref,cat_title,cat_description,cat_parent_ref,cat_image,cat_image1,cat_file,cat_shorttext,cat_longtext,cat_number,cat_bool,cat_listofattributes,cat_weblink,cat_date,cat_relateditems,cat_table"
  }
}

Querying Categories

To retrieve category data, use the Categories endpoint with the desired parameters.

[GET] Categories Endpoint

https://api2.saleslayer.com/rest/Catalog/Categories

Making a request

  • Use the HTTP method: GET.
  • Include the API key in the request headers for authentication.
  • Specify the fields to retrieve using the $select parameter.
  • http://api2.saleslayer.com/rest/Catalog/Categories?$select=cat_id,cat_title 

    Receiving a response

    When you make a request to our API, you will receive a response in the form of a JSON object. This object will contain the data requested, as well as any relevant metadata such as status codes and error messages.

    {
      "value": [
        {
          "cat_id": 2,
          "cat_title": {
            "es": "Mujer"
          }
        },
        {
          "cat_id": 3,
          "cat_title": {
            "es": "Verano"
          }
        },
        {
          "cat_id": 4,
          "cat_title": {
            "es": "Camisas"
          }
        },
        {
          "cat_id": 5,
          "cat_title": {
            "es": "Camisetas"
          }
        },
        {
          "cat_id": 6,
          "cat_title": {
            "es": "Invierno"
          }
        }
      ],
      "@count": 16,
      "@readLink": "https://api2.saleslayer.com/rest/Catalog/Categories?$top=5&$select=cat_id,cat_title",
      "@nextLink": "https://api2.saleslayer.com/rest/Catalog/Categories?$top=5&$select=cat_id,cat_title&$skip=5"
    }

    [GET] A Category resource Endpoint

    https://api2.saleslayer.com/rest/Catalog/Categories({categoryIdentifier})

    Making a request

    • Use the HTTP method: GET.
    • Include the API key in the request headers for authentication.
    • Specify the fields to retrieve using the $select parameter
    • Specify the categoryIdentifier
    https://api2.saleslayer.com/rest/Catalog/Categories(6)?$select=cat_title,cat_parent_ref

    Receiving a response

    Select the properties Category resources using the $select parameter (is available in the JSON schema returned by the /Categories/$metadata endpoint) and get a response

    {
      "value": {
        "cat_title": {
          "es": "Invierno"
        },
        "cat_parent_ref": "MUJERref01"
      },
      "@readLink": "https://api2.saleslayer.com/rest/Catalog/Categories(6)?$select=cat_title,cat_parent_ref",
      "@editLink": "https://api2.saleslayer.com/rest/Catalog/Categories(6)?$select=cat_title,cat_parent_ref"
    }