Magidoc

A GraphQL API only has one endpoint, to which you will send all your queries: POST https://api.orderchamp.com/v1/graphql

Tip: use our online GraphiQL client to test your queries .
(you need a supplier account to use the API. Register here )

Your first API call

#

We recommend you download and use the GraphQL App or an API GUI like Paw . You can also use our online GraphiQL client .

Once you've installed the app, you can test it by running the following query:

    
  

A successful query results in a response similar to the following:

    
  

Congratulations, you’ve made your first API call.

Example Queries

#

In GraphQL, queries are the equivalent of REST’s GET action verb. They generally begin with one of the objects listed under QueryRoot and can get data from any connections that object has. Even though a POST is being sent to the GraphQL endpoint, if the body only contains queries, data will only be retrieved and not modified.

Query the inventory levels of the first ten variants.

    
  

Example Mutations

#

Mutations are the equivalent of REST’s data-modifying action verbs.

Create a product.

    
  

User errors

#

It is important that for every mutation you execute, you also request the userErrors object, which may optionally contain errors which have occurred while executing your mutation.

For example lets try to leave the brand field empty

    
  

In the response, we'll see error message