Get products from graphql endpoint, Collection - Product Hierarchy

Highlighted
New Member
6 0 0

query product from collection

query myquery{

collectionByHandle(handle:"handle_name")

  {

      products(first: 10 query:"price:>10 price:<=8000")

      {

            edges

             {

                  node

                  {

                        id

                        title

                        variants(first:10)

                        {

                              edges

                              {

                                  node

                                  {

                                        id

                                        price

                                  }

                              }

                          }

                   }

              }

       }

   }

}

but I'm not able not to get products, i got response as 'access denied'

{
"data": {
"collectionByHandle": null
},
"errors": [
{
"message": "access denied",
"locations": [
{
"line": 7,
"column": 7
}
],
"path": [
"collectionByHandle",
"products"
]
}
],
"extensions": {
"cost": {
"requestedQueryCost": 133,
"actualQueryCost": 3,
"throttleStatus": {
"maximumAvailable": 1000,
"currentlyAvailable": 997,
"restoreRate": 50
}
}
}
}

0 Likes
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
624 103 124

Hi @Deva ,

 

This is known behaviour. Shopify does not support the filtration/query of products within a Collection connection in the GraphQL Admin API, due to the expensive nature of queries. However if you removed the 'query' argument from the products and kept it as "first:10" only, you would not get any errors. Read the threads here for more information: 

https://community.shopify.com/c/Shopify-APIs-SDKs/Getting-quot-access-denied-quot-when-querying-with...

https://community.shopify.com/c/Shopify-APIs-SDKs/Graph-QL-Access-denied-Issue/td-p/572801

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

1 Like
Highlighted
New Member
6 0 0

Thank you @hassain for your reply ,

I'll need to filter products by particular range within  a collection, is there any room to retrieve it ?

0 Likes