Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

i have query that over the limit of cost i want to know how i can split my query for small pieces

Solved

i have query that over the limit of cost i want to know how i can split my query for small pieces

hmjeh
Tourist
11 3 0

my query is

 

query {
      orders(first:33, query:"fulfillment_status:unfulfilled AND shippingAddress.country:United States AND -tag:'handdle by itamar wherhous'"){
        edges {
          node {
            id
            tags
            displayFulfillmentStatus
            shippingAddress {
              address1
              city
              country
              firstName
              lastName
              phone
              provinceCode
              zip
            }
            lineItems(first: 7) {
              nodes {
                quantity
                product {
                  id
                }
                variant {
                  sku
                }
              }
            }
            fulfillmentOrders(first: 3, reverse: true) {
              nodes {
                id
               
              }
            }
          }
        }
      }
    }

 

and if change to 

 

orders(first:34, query:"fulfillment_status:unfulfilled AND shippingAddress.country:United States AND -tag:'handdle by itamar wherhous'"){

 

i got this error 

 

 

{
  "errors": [
    {
      "message": "Query cost is 1022, which exceeds the single query max cost limit (1000).\n\nSee https://shopify.dev/concepts/about-apis/rate-limits for more information on how the\ncost of a query is calculated.\n\nTo query larger amounts of data with fewer limits, bulk operations should be used instead.\nSee https://shopify.dev/api/usage/bulk-operations/queries for usage details.\n",
      "extensions": {
        "code": "MAX_COST_EXCEEDED",
        "cost": 1022,
        "maxCost": 1000,
        "documentation": "https://shopify.dev/api/usage/rate-limits"
      }
    }
  ]
}

 

 

i have more then 33 items i have around 300  my question is how i can query in loop first time until 33 and next iteration from 34 until 66 And so on

Accepted Solution (1)

Jason
Shopify Partner
11206 226 2315

This is an accepted solution.

Have you taken a look at pagination?
https://shopify.dev/api/usage/pagination-graphql

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★

View solution in original post

Replies 2 (2)

Jason
Shopify Partner
11206 226 2315

This is an accepted solution.

Have you taken a look at pagination?
https://shopify.dev/api/usage/pagination-graphql

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★
hmjeh
Tourist
11 3 0

Thank you very much it helped me