[GET] Products and Metadata

Products Overview

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

Metadata

The metadata is a JSON schema document that describes all resources within the Products 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., Variants).
  • The metadata is essential for understanding which fields can be queried and expanded.

[GET] Products Metadata Endpoint

https://api2.saleslayer.com/rest/Catalog/Products/$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/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"
          ]
        },
        "prod_stat": {
          "title": "Status",
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "V",
            "I",
            "D",
            "R"
          ],
          "default": "R"
        },
        "prod_description": {
          "title": "prod_description",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "object",
            "properties": {
              "culture": {
                "type": "string",
                "enum": [
                  "de",
                  "en",
                  "en-us",
                  "es",
                  "fr"
                ],
                "default": "en"
              },
              "value": {
                "type": "string"
              }
            },
            "required": [
              "culture"
            ]
          }
        },
        "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"
        }
      },
      "required": [
        "frmt_ref"
      ]
    }
  ],
  "readLink": {
    "uri": "https://api2.saleslayer.com/rest/Catalog/Products/$metadata"
  }
}

Querying Products

To retrieve products data, use the Products endpoint with the desired parameters.

[GET] Products Endpoint

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

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.
  • https://api2.saleslayer.com/rest/Catalog/Products?$select=prod_id

    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": [
        {
          "prod_id": 3
        },
        {
          "prod_id": 4
        },
        {
          "prod_id": 5
        }
      ],
      "@count": 225,
      "@readLink": "https://api2.saleslayer.com/rest/Catalog/Products?$top=3&$select=prod_id",
      "@nextLink": "https://api2.saleslayer.com/rest/Catalog/Products?$top=3&$select=prod_id&$skip=4"
    }

    Apply filters

    Select different properties of the product and apply Filters and Expand (only for Variants), the Json will return this object with the requested data

    https://api2.saleslayer.com/rest/Catalog/Products?$filter=contains(prod_title, 'abrigo')&$select=prod_id, prod_title, prod_ref&$expand=Variants

    {
      "value": [
        {
          "prod_id": 77,
          "prod_title": {
            "es": "Abrigo cuello desmontable"
          },
          "prod_ref": "42PM020100481",
          "Variants@count": 0
        },
        {
          "prod_id": 80,
          "prod_title": {
            "es": "Abrigo corto doble faz es"
          },
          "prod_ref": "42PM023905631",
          "Variants@count": 1
        },
        {
          "prod_id": 81,
          "prod_title": {
            "es": "Abrigo contrastes cuadros - es "
          },
          "prod_ref": "89120101142785",
          "Variants@count": 43
        },
        {
          "prod_id": 136,
          "prod_title": {
            "es": "Abrigo de piel"
          },
          "prod_ref": "42PM703906271",
          "Variants@count": 0
        }
      ],
      "@count": 7,
      "@readLink": "https://api2.saleslayer.com/rest/Catalog/Products?$filter=contains(prod_title, 'abrigo')&$select=prod_id, prod_title, prod_ref&$expand=Variants"
    }

    [GET] A product resource Endpoint

    https://api2.saleslayer.com/rest/Catalog/Products({productIdentifier})

    Making a request

  • Use the HTTP method: GET.
  • Include the API key in the request headers for authentication.
  • Specify the productIdentifier
  • https://api2.saleslayer.com/rest/Catalog/Products(3)

    Receiving a response

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

    {
      "value": {
        "prod_stat": "I",
        "prod_title": {
          "es": "WOOL COAT1"
        },
        "cat_ref": [
          "INVIREF-023",
          "CAMI01"
        ],
        "prod_tags": "conector  1,blackfriday"
      },
      "@readLink": "https://api2.saleslayer.com/rest/Catalog/Products(3)?$select=prod_title, cat_ref, prod_tags, prod_stat",
      "@editLink": "https://api2.saleslayer.com/rest/Catalog/Products(3)?$select=prod_title, cat_ref, prod_tags, prod_stat"
    }