Query the product catalog

Use the dataSets object to check the structure of the product catalog in your Connect subscription:

  • The ID of the catalog (it's required for mutations).
  • The product attributes available in the product catalog.
{
  dataSets(filter: { field: "type", eq: "PRODUCT_CATALOG" }) {
    nodes {
      dataSetId
      name
      attributes {
        name
        validateAs
        defaultDisplayText
      }
    }
  }
}
{
  "data": {
    "dataSets": {
      "nodes": [
        {
          "dataSetId": "1e51480c-074a-5fd7-aaaa-000000000",
          "name": "Product Catalog",
          "attributes": [
            {
              "name": "category",
              "validateAs": null,
              "defaultDisplayText": "Category"
            },
            {
              "name": "productId",
              "validateAs": null,
              "defaultDisplayText": "Product ID"
            },
            {
              "name": "productName",
              "validateAs": null,
              "defaultDisplayText": "Product Name"
            },
            {
              "name": "model",
              "validateAs": null,
              "defaultDisplayText": "Model"
            },
            {
              "name": "unitPrice",
              "validateAs": null,
              "defaultDisplayText": "Unit Price"
            },
            {
              "name": "discount",
              "type": "NUMBER",
              "validateAs": null,
              "predefined": true,
              "defaultDisplayText": "Discount"
            },
            {
              "name": "currency",
              "validateAs": null,
              "defaultDisplayText": "Currency"
            },
            {
              "name": "dateAdded",
              "validateAs": null,
              "defaultDisplayText": "Date Added"
            },
            {
              "name": "tags",
              "validateAs": "TEXT",
              "defaultDisplayText": "Attributes"
            }
          ]
        }
      ]
    }
  }
}

Running the query

If you haven't used our API before, see Using the Connect API for instructions. It explains how to authenticate your calls and suggests some tools for testing.

Query structure

Arguments

To query the product catalog, you need the filter argument to distinguish the catalog from other datasets in your Connect subscription. filter is an object with the following required fields.

FieldValuesDefinition
fieldString. Valid value - type.The name of the field for filtering
eqString. Valid value -
PRODUCT_CATALOG.
The value that the type field must be equal to

Fields

The response has the nodes object at the root level. See the fields supported by the object. All of them are optional.

FieldValuesDefinition
attributesObjectThe list of default and custom product attributes available in the product catalog
dataSetIdIDThe ID of the product catalog (assigned automatically). It is required for mutations when you add, update or delete products.
nameStringThe name of the product catalog

Fields supported by the attributes object. All of them are optional.

FieldValuesDefinition
defaultDisplayTextString The name of an attribute as it appears in the Connect application. Applies only to the predefined attributes (they have an additional internal name).
nameStringThe name of a product attribute. ❕ You need it for mutations.

- If it's a predefined attribute, then name returns its internal name. To check the name displayed in the Connect application, see defaultDisplayText.
- For a custom attribute, this is the internal name and the UI label.
validateAsEnumeration.

Valid values for text attributes: null, TEXT and URL.

Valid values for array attributes: BOOLEAN, DATE, null, NUMBER, TEXT and URL.
This field provides additional details about the data format. For example, it can specify that a text attribute contains URLs or that an array is an array of numeric values.

⚠️ validateAs applies only to the product attributes of the TEXT and ARRAY types.