GraphQL Commerce Schema

Introduction

You can explore the GraphQL Schema through the GraphQL Playground or browse the HTML documents.

Bloomreach provides a GraphQL Playground, a graphical, interactive, in-browser GraphQL IDE tool. You can take advantage of the GraphQL Playground to understand the GraphQL schema provided by the GraphQL Commerce.

Developers can understand the GraphQL schema of models, and execute queries and mutations against the GraphQL Commerce.

Exploring GraphQL Schema with the GraphQL Playground

Visual Exploration on the GraphQL Schema

Visit the GraphQL Playground on this site.

897

In the GraphQL Playground tool, you can do the following:

  • Explore the GraphQL schema of models provided by the GraphQL Commerce for your GraphQL client applications.
  • Explore the GraphQL queries and mutations provided by the GraphQL Commerce for your GraphQL client applications.
  • Execute GraphQL queries and mutations by writing statements on the left pane and get the GraphQL responses from the GraphQL Commerce.

Tips On How To Use the GraphQL Playground

Autocompletion in the Query/Mutation editor pane

In the query/mutation editor pane, try to type in "query" or "mutation" and a space. After that, enter the autocompletion key combination such as Shift+Space or Ctrl+Space depending on your system. The GraphQL Playground will provide an autocompletion experience listing all available query/mutation functions you can use. It will list all available field names in the field listing section too for the developers' convenience.

HTTP headers

As explained with examples in Access Management in GraphQL Commerce, every GraphQL request should include both authorization and connector HTTP headers. When using the GraphQL Playground, you need to set HTTP headers like the following:

{
  "connector": "<CONNECTOR_ID>",
  "authorization":"Bearer <ACCESS_TOKEN>"
}

Replace the <CONNECTOR_ID> with the connector ID you want to interact with. e.g, "commercetools", "sap", etc.
And replace the <ACCESS_TOKEN> with the value of the "authorization" property in the JSON response from commands like the following:

curl -i -d '{"username":"<USERNAME>", "password":"<PASSWORD>"}' -H 'Content-Type: application/json' -H 'connector: <CONNECTOR_ID>' https://localhost:4000/signin
HTTP/1.1 200 OK
...
Content-Type: application/json; charset=utf-8
...

{"authorization":"eyJlbmMiOi..."}

GraphQL Schema Data Mappings for Bloomreach Discovery

To understand how the data from Bloomreach Discovery is mapped to the GraphQL Schema, see the following page: