The API playground
Try the storefront API and GraphQL with the shop's own products and collections, see the JSON your website gets, and copy the request as curl or JavaScript.
How-to guide2 min read
The API playground runs the storefront API and GraphQL the way your website does. Open it under Developers in the sidebar. It needs no key, and the shop address is filled in for you, such as northwilds.
Run a request
- Choose REST or GraphQL.
- With REST, pick an endpoint on the left and fill in its parameters. Lists offer the shop's own active products and collections, so you don't need to look up an address.
- Choose Run, or press ⌘ and Enter (Ctrl and Enter on Windows).
The answer appears with its status, such as 200, how long it took and its size, and can be copied whole.
The REST endpoints come in three groups:
- Shop: the shop's name, currencies and languages
- Catalogue: Products, One product, Collections and One collection
- Cart: Create a cart, Read a cart, Change a cart, Check out and An order
Under the parameters, each endpoint describes what it returns, field by field.
Carts
Create a cart starts a real cart with an example body: one of the shop's products in its main currency and language. Copy the token from the answer into Read a cart and Change a cart to try discount codes, countries and shipping choices, and to see how VAT and totals change. A cart without an email is never contacted, so trying carts is harmless. Leave the email out unless it is your own.
What isn't run here
Some endpoints are described but can't be run from the playground:
- Check out: it places a real order, takes stock and emails the customer. Read the cart instead to see what checkout would charge. See Checkout with Stripe.
- An order: it needs a real order and the email address it was placed with.
GraphQL
With GraphQL, the side shows the schema: every query, such as products or collection, with its arguments and fields. Build a query from it or write your own, and add variables if it has any.
Run with a key
Reading works without a key. To run a request the way your server would, paste a key from API keys at the top. With a secret key, Products and One product also return draft products. The key stays in this browser, and the curl and JavaScript you copy include it. Empty the field to run without it again.
Languages and currencies
Choose a language at the top, such as nb, and every request asks for it. The product endpoints also take a currency. Without them, answers are in the shop's main language and currency.
Copy the request
Open curl or JavaScript under the request to see the same request as a command or as fetch code, with the full address your website calls, and copy it into your terminal or your code.
Was this page helpful?