# 8.SET Custom

## What we want to build

We want to show the set images and a slider with the set products. We only want to show up to 2 similar products for each product.

<figure><img src="/files/2yh7DMOJVEeFqNoWDBE6" alt=""><figcaption></figcaption></figure>

## GraphQL query and response

You can request custom set content for a given product identifier or you can request a specific set by it's id.

### Custom Set for product - 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.

{% tabs %}
{% tab title="GraphQL query" %}

```graphql
query {
  product(id: "8S-DEMO-Polohemd-1") {
    customSets {
      edges {
        node {
          id
          title
          description
          images {
            edges {
              node {
                url
              }
            }
          }
          products {
            id
            similarProducts(first: 2) {
              edges {
                node {
                  id
                }
              }
            }
          }
        }
      }
    }
  }
}
```

{% endtab %}

{% tab title="cURL request" %}
{% code overflow="wrap" %}

```bash
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    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"}'
```

{% endcode %}
{% endtab %}

{% tab title="response" %}

```json
{
  "data": {
    "product": {
      "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"
                        }
                      }
                    ]
                  }
                }
              ]
            }
          }
        ]
      }
    }
  }
}
```

{% endtab %}
{% endtabs %}

### Custom Set by id - 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.

{% tabs %}
{% tab title="GraphQL query" %}

```graphql
query {
  customSet(id: "e3bcaf66-5037-4d7b-be4a-8c571a6fb299") {
    id
    title
    description
    images {
      edges {
        node {
          url
        }
      }
    }
    products {
      id
      similarProducts(first: 2) {
        edges {
          node {
            id
          }
        }
      }
    }
  }
}

```

{% endtab %}

{% tab title="cURL request" %}
{% code overflow="wrap" %}

```bash
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  customSet(id: \"e3bcaf66-5037-4d7b-be4a-8c571a6fb299\") {\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"}'
```

{% endcode %}
{% endtab %}

{% tab title="response" %}

```json
{
  "data": {
    "customSet": {
      "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"
                }
              }
            ]
          }
        }
      ]
    }
  }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.8select.io/api/examples/8.set-custom.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
