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

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 Expert
11196 226 2287

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 Expert
11196 226 2287

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