8SELECT - Integration Documentation
8SELECTService Status
  • 8.HX PLATFORM
  • Shop Integration
    • 8.SDK Web (JavaScript SDK)
    • Widgets
      • ➕Add more elements, like custom headline
      • 👻Hide recommendation area in case there is no content
      • 🔎Adding widgets after 8.SDK was loaded
      • 🗺️Internationalization
    • Shopping Cart
    • Checkout Tracking
    • Product Export
    • A/B Testing
    • Single Page Application
    • Tag Manager
    • Data Privacy / Cookies / GDPR
  • Widgets
    • 8.SIMILAR
    • 8.SET
    • 8.SET Custom
    • Touchpoints
      • Product Page
      • Cart Layer
      • Cart
      • Content Page
  • Product Export
    • Data Transfer
    • File Format
    • Base Data
      • Details and examples
    • Fashion Content Pool
      • Details and examples
    • Image Bot
  • Sandbox
    • Demo-Integration
    • Demo-Mode
  • API
    • Changelog
      • 2.0.0
      • 1.0.1
    • General
      • Introduction
      • Authentication
      • Pagination
      • Exceptions
      • GraphQL Schema
    • Examples
      • 8.SIMILAR
      • 8.SET
      • 8.SET Custom
      • Product Page - All Content
  • API Tracking
    • Changelog
    • General
      • Introduction
      • Authentication
      • Context
      • User Identification
      • Event Validation
    • Events
      • view
        • How to evaluate if view event can be sent
        • User views 8.SET content
      • interact
        • User clicks on a product within 8.SET content
        • User adds a product to their card from within 8.SET content
        • Example what is not a product interaction
      • order
Powered by GitBook
On this page
  • What we want to build
  • GraphQL query and response - id only

Was this helpful?

  1. API
  2. Examples

Product Page - All Content

Fetch all available content for a given product identifier.

Previous8.SET CustomNextChangelog

Last updated 10 months ago

Was this helpful?

What we want to build

We want to show a custom set, similar products and matching products on our product page.

With the power of GraphQL we can request not only one type of content but all in one query. That way we can fetch all available content with just one HTTP request.

For the matching products we do not want to show similar products for our current product, only other matching categories. So we will request up to 6 matchingProductClusters and will skip the first one when we render our UI.

GraphQL query and response - id only

To ensure that you show the most recent data in you shop you should only query the product ids and fetch the rest of the data you need for your UI from your own database.

In case you can not make the extra roundtrip you can actually query all the data that is required to render a basic UI. Just consult the GraphQL schema.

query {
  product(id: "8S-DEMO-Polohemd-1") {
    matchingProductClusters(first: 6) {
      edges {
        node {
          products(first: 3) {
            edges {
              node {
                id
              }
            }
          }
        }
      }
    }
    similarProducts(first: 8) {
      edges {
        node {
          id
        }
      }
    }
    customSets {
      edges {
        node {
          id
          title
          description
          images {
            edges {
              node {
                url
              }
            }
          }
          products {
            id
            similarProducts(first: 2) {
              edges {
                node {
                  id
                }
              }
            }
          }
        }
      }
    }
  }
}
curl --request POST \
  --url https://api.8select.io/graphql \
  --header 'Content-Type: application/json' \
  --header 'x-api-id: db54750f-80fc-4818-9455-30ca233225dc' \
  --data '{"query":"query {\n  product(id: \"8S-DEMO-Polohemd-1\") {\n    matchingProductClusters(first: 6) {\n      edges {\n        node {\n          products(first: 3) {\n            edges {\n              node {\n                id\n              }\n            }\n          }\n        }\n      }\n    }\n    similarProducts(first: 8) {\n      edges {\n        node {\n          id\n        }\n      }\n    }\n    customSets {\n      edges {\n        node {\n          id\n          title\n          description\n          images {\n            edges {\n              node {\n                url\n              }\n            }\n          }\n          products {\n            id\n            similarProducts(first: 2) {\n              edges {\n                node {\n                  id\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n"}'
{
  "data": {
    "product": {
      "matchingProductClusters": {
        "edges": [
          {
            "node": {
              "products": {
                "edges": [
                  {
                    "node": {
                      "id": "8S-DEMO-Polohemd-10"
                    }
                  },
                  {
                    "node": {
                      "id": "8S-DEMO-Polohemd-7"
                    }
                  },
                  {
                    "node": {
                      "id": "8S-DEMO-Polohemd-8"
                    }
                  }
                ]
              }
            }
          },
          {
            "node": {
              "products": {
                "edges": [
                  {
                    "node": {
                      "id": "8S-DEMO-Uhr-1"
                    }
                  },
                  {
                    "node": {
                      "id": "8S-DEMO-Uhr-2"
                    }
                  }
                ]
              }
            }
          },
          {
            "node": {
              "products": {
                "edges": [
                  {
                    "node": {
                      "id": "8S-DEMO-Gürtel-3"
                    }
                  },
                  {
                    "node": {
                      "id": "8S-DEMO-Gürtel-4"
                    }
                  },
                  {
                    "node": {
                      "id": "8S-DEMO-Gürtel-1"
                    }
                  }
                ]
              }
            }
          },
          {
            "node": {
              "products": {
                "edges": [
                  {
                    "node": {
                      "id": "8S-DEMO-Hose-1"
                    }
                  },
                  {
                    "node": {
                      "id": "8S-DEMO-Hose-3"
                    }
                  }
                ]
              }
            }
          },
          {
            "node": {
              "products": {
                "edges": [
                  {
                    "node": {
                      "id": "8S-DEMO-Handschuhe-1"
                    }
                  },
                  {
                    "node": {
                      "id": "8S-DEMO-Handschuhe-2"
                    }
                  },
                  {
                    "node": {
                      "id": "8S-DEMO-Handschuhe-3"
                    }
                  }
                ]
              }
            }
          },
          {
            "node": {
              "products": {
                "edges": [
                  {
                    "node": {
                      "id": "8S-DEMO-Jacket-2"
                    }
                  },
                  {
                    "node": {
                      "id": "8S-DEMO-Jacket-1"
                    }
                  }
                ]
              }
            }
          }
        ]
      },
      "similarProducts": {
        "edges": [
          {
            "node": {
              "id": "8S-DEMO-Polohemd-1"
            }
          },
          {
            "node": {
              "id": "8S-DEMO-Polohemd-10"
            }
          },
          {
            "node": {
              "id": "8S-DEMO-Polohemd-9"
            }
          },
          {
            "node": {
              "id": "8S-DEMO-Polohemd-7"
            }
          },
          {
            "node": {
              "id": "8S-DEMO-Polohemd-8"
            }
          },
          {
            "node": {
              "id": "8S-DEMO-Polohemd-2"
            }
          },
          {
            "node": {
              "id": "8S-DEMO-Polohemd-3"
            }
          },
          {
            "node": {
              "id": "8S-DEMO-Polohemd-4"
            }
          },
          {
            "node": {
              "id": "8S-DEMO-Polohemd-5"
            }
          }
        ]
      },
      "customSets": {
        "edges": [
          {
            "node": {
              "id": "e3bcaf66-5037-4d7b-be4a-8c571a6fb299",
              "title": "8SELECT Fashion for everyday",
              "description": "This is a demo set. It is here to preview the 8.SET Custom widget.",
              "images": {
                "edges": [
                  {
                    "node": {
                      "url": "https://thumbnails.8scdn.io/9056af8c-e9b8-50db-bdf1-f794dc2e10d7.jpg"
                    }
                  }
                ]
              },
              "products": [
                {
                  "id": "8S-DEMO-Jacket-1",
                  "similarProducts": {
                    "edges": [
                      {
                        "node": {
                          "id": "8S-DEMO-Jacket-2"
                        }
                      }
                    ]
                  }
                },
                {
                  "id": "8S-DEMO-Polohemd-1",
                  "similarProducts": {
                    "edges": [
                      {
                        "node": {
                          "id": "8S-DEMO-Polohemd-10"
                        }
                      },
                      {
                        "node": {
                          "id": "8S-DEMO-Polohemd-9"
                        }
                      }
                    ]
                  }
                },
                {
                  "id": "8S-DEMO-Gürtel-1",
                  "similarProducts": {
                    "edges": [
                      {
                        "node": {
                          "id": "8S-DEMO-Gürtel-3"
                        }
                      },
                      {
                        "node": {
                          "id": "8S-DEMO-Gürtel-4"
                        }
                      }
                    ]
                  }
                },
                {
                  "id": "8S-DEMO-Hose-1",
                  "similarProducts": {
                    "edges": [
                      {
                        "node": {
                          "id": "8S-DEMO-Hose-2"
                        }
                      },
                      {
                        "node": {
                          "id": "8S-DEMO-Hose-3"
                        }
                      }
                    ]
                  }
                },
                {
                  "id": "8S-DEMO-Schuhe-1",
                  "similarProducts": {
                    "edges": [
                      {
                        "node": {
                          "id": "8S-DEMO-Schuhe-2"
                        }
                      },
                      {
                        "node": {
                          "id": "8S-DEMO-Schuhe-3"
                        }
                      }
                    ]
                  }
                }
              ]
            }
          }
        ]
      }
    }
  }
}