GraphQL API
Search…
GraphQL
A brief introduction to GraphQL, how we retrieve data through our API, and where to go for more resources.

What is GraphQL?

GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. It isn't tied to any specific database or storage engine and is instead backed by your existing code and data. GraphQL provides a complete and understandable description of the data in your API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful developer tools.
If you're new to GraphQL, Apollo has resources for beginners. While the official documentation is another good starting point.

GraphQL Schema Language

A GraphQL service is created by defining types and fields on those types, then providing functions for each field on each type. For example, a GraphQL service that tells us about a specific product and its characteristics might look something like this:
1
query Query($productId: ID) {
2
Product(id: $productId) {
3
name
4
price
5
quantity
6
status
7
sku...
8
}
9
}
Copied!
GraphQL allows us to define and describe our data structures. For this purpose, GraphQL provides a typed schema language. We specify custom types for the data served by the API. A GraphQL schema is created by defining types, which have a number of fields, and by providing access functions for each field and each type.

The GraphQL API

Outshifter is powered by a GraphQL API. Unlike REST APIs, it gives the client control over how much or how little data they want to request about each object and allows relations within the object graph to be easily traversed.
To learn more about GraphQL language and its concepts please see the official GraphQL website and documentation.
The API endpoint is available at /graphql/ and requires queries to be submitted using HTTP POST method and the application/json content type.
Using the Outshifter GraphQL API allows you to query and modify all of your channels data in an efficient and flexible manner. Our API provides both types of operations:
  • Public - Related to the users of your Channel.
  • Private - Related to the administration side.
Here's an example query to fetch a category name:
1
{
2
sales-channel {
3
name
4
}
5
}
Copied!
Response:
1
{
2
"data": {
3
"sales-channel": {
4
"name": "my company e-commerce"
5
}
6
}
7
}
Copied!