close

Filter

loading table of contents...

Headless Server Developer Manual / Version 2101

Table Of Contents

6.2 Categories

Similar to products, categories can be retrieved as a part of a catalog query, or by navigating from a CMExternalChannel content query to the corresponding category. And, as with products, categories may be queried by their external ID. The following query fetches a root category together with the child categories up to the second level:

{
  commerce {
    category(categoryId: "ibm:///catalog/category/techId:ROOT",
             siteId: "99c8ef576f385bc322564d5694df6fc2") {
      name
      externalId
      ...CategoryFragment
      children {
        ...CategoryFragment
        children {
          ...CategoryFragment
        }
      }
    }
  }
}

fragment CategoryFragment on Category {
  name
  externalId
  products {
    name
    externalId
    listPrice
  }
}

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.