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 is GraphQL?
  • Why use GraphQL?
  • How to query GraphQL?

Was this helpful?

  1. API
  2. General

Introduction

At 8SELECT we are working towards providing centralized access to all of our products using GraphQL as the main API technology.

PreviousGeneralNextAuthentication

Last updated 10 months ago

Was this helpful?

What is GraphQL?

GraphQL is a query language for clients to fetch data they need from an API. It is defined through a , which describes how data should be requested and formatted in a response.

GraphQL is strongly typed and well structured. That means, an API will not only define and guarantee what type of data each field in its schema can be, but also define the links and relationships between any complex objects. This enables queries to fetch exactly the information they need by specifying either a single object or traversing any links in the structure to request related information in a single query.

Why use GraphQL?

At 8SELECT we use GraphQL primarily because it enables developers to make API calls which gets them exactly what data they need in the simplest way possible. Since it is a well structured schema you can fetch data and know that you will get the data back in a guaranteed format and because of that, tooling can make development significantly easier.

How to query GraphQL?

Most commonly GraphQL can be queried by making HTTP POST requests to its respective endpoint. At 8SELECT this endpoint currently is https://api.8select.io/graphql. To make a request you can use cURL or any other HTTP compatible client. There are also various GraphQL specific clients available in different programming languages.

You get query content for a given product identifier or query a specific custom-set.

Assuming you have a product with the SKU 8S-DEMO-Polohemd-1 in your catalogue, you could use the following example to query a list of similar products.

product(id: "8S-DEMO-Polohemd-1") {
   similarProducts(first: 5) {
      edges {
        node {
          id
        }
      }
    }
  }
}

To send this query to the GraphQL endpoint you would use the following request in curl

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    similarProducts(first: 5) {\n      edges {\n        node {\n          id\n        }\n      }\n    }\n  }\n}\n"}'

And the result will be a list of similar products limited to the first 5

{
  "data": {
    "product": {
      "similarProducts": {
        "edges": [
          {
            "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"
            }
          }
        ]
      }
    }
  }
}

Further Information

To find out more about GraphQL in general, read the official and learn about writing efficient .

specification
GraphQL documentation
GraphQL queries