Query your API

If you have followed all the previous steps in this section, then you are ready to run your first StoreAPI queries!

Run your GraphQL client of choice and do a little configuration first.

Start by setting the queries and mutations destination to StoreAPI endpoint: https://storeapi.jetshop.io/.

Configure the request headers sent with each query (without these headers StoreAPI will reject all sent queries):

  • token: <your token>
  • shopid: demostore

As you may remember, we posted a sample query retrieving product data on the Overview page. Try it for yourself by pasting it into your client app and running the query. What are the results of the run? How about you modify that query a bit and try again as below?

productByArticleNumber-inputproductByArticleNumber-queryproductByArticleNumber-output
Copy
Copied
{
  "articleNumber": "518198676"
}
Copy
Copied
  query MyProductQuery($articleNumber: String!) {
    product(articleNumber: $articleNumber) {
      name
      campaigns{name}
      price{incVat}
    }
  }
Copy
Copied
{
  "data": {
    "product": {
      "name": "Bike 26\" preorder",
      "campaigns": [],
      "price": {
        "incVat": 8799
      }
    }
  }
}

Play around by modifying the query yourself to get more powerful results. Your GraphQL client will tell you what other fields you can use to build your query.

productById-inputproductById-queryproductById-output
Copy
Copied
{
  "id": 563  
}
Copy
Copied
  query MyProductQuery($id: Int!) {
    product(id: $id) {
      name
      id
      subName
      shortDescription
      articleNumber
      variants {
        values {
          price {
            incVat
          }
        }
      }
      price {
        incVat
      }
    }
  }
Copy
Copied
{
  "data": {
    "product": {
      "name": "Dining Table",
      "id": 563,
      "subName": "Wooden",
      "shortDescription": "",
      "articleNumber": "9341387",
      "variants": {
        "values": [
          {
            "price": {
              "incVat": 7980
            }
          },
          {
            "price": {
              "incVat": 8980
            }
          }
        ]
      },
      "price": {
        "incVat": 7980
      }
    }
  }
}

Bravo! You are now ready to use StoreAPI seamlessly!

Copyright © Norce 2023. All right reserved.