GraphQL API

This document gives an overview of GraphQL API.

The commercetools platform provides a GraphQL API.
It currently provides access to products, categories and channels.
You can access the GraphQL endpoint with following URL:

https://api.sphere.io/{projectKey}/graphql

It accepts POST requests with following properties in a JSON body:

Here is an example of a GraphQL query:

$ curl -X POST https://api.sphere.io/my-shop/graphql \
  -H "Content-Type:application/json" \
  -H "Authorization:Bearer ..." \
  -d '{"query": "query ($sku: String!) {product(sku: $sku) {id version}}", "variables": {"sku": "SKU-123"}}'

Product attributes are dynamically inserted into the GraphQL schema, depending on your ProductType definitions, in an eventually consistent fashion.

In order to explore the GraphQL API, you can use an interactive GraphiQL environment which is available as a part of Impex.
Here is a short demonstration if the GraphiQL tool and how you can use it to discover the schema:

GraphiQL demonstration