With GraphQL, how could we get a product & list of products?

mattfrancis888
New Member
3 0 0

Here is what I tried:

 

To get a list of products (Taken from: https://community.shopify.com/c/Shopify-APIs-SDKs/How-to-retrive-all-the-products-of-shop-using-Grap...)

{
   products(first: 2) {
   edges {
      cursor
      node {
        id
     }  
    }
  }
}

To get a specific product id (Taken from: https://shopify.dev/docs/admin-api/graphql/examples/product)

{
 query product(id: "gid://shopify/Product/6716637249718") { 
  title 
  description
 }
}

 

However, with both commands above, I am getting an error of (in Shopify's GraphiQL):

8737caa33f944b999618b1617d49321d

 

Why is this happening?

 

0 Likes
mattfrancis888
New Member
3 0 0

Fixed it! There was an extra { } that I didn't remove - it was causing the error.

0 Likes