GrapQL loading all orders with all LineItems,Fulfillments etc

Topic summary

Main issue: Migrating from REST to GraphQL and wanting complete order details (orders with all line items, fulfillments, etc.) without specifying item counts or paginating nested connections, and without high query cost.

Key points:

  • In GraphQL, lists are exposed as connections and require pagination (e.g., first:N) with pageInfo (hasNextPage, endCursor) to fetch subsequent pages. This is by design and helps control cost.
  • Consider whether all nested data is truly needed at once; if full, denormalized order payloads are required, REST may be better suited for that use case.
  • Mixing REST and GraphQL is acceptable depending on the task.

Latest recommendation:

  • Use GraphQL Bulk Operations to retrieve complete datasets without specifying first on connections; it runs asynchronously and returns all matching data, suitable for large exports.

Status/outcome:

  • No single resolution; multiple viable paths offered: paginate via GraphQL, continue using REST for full payloads, or use Bulk Operations for complete data extraction, depending on needs and cost constraints.
Summarized with AI on December 20. AI used: gpt-5.

Im trying to migrate things from REST to GraphQL.

But i find it really strange that i have to specify a number of line items when im fetching orderdata?
in what world would you ever want to see only the first 3 orderlines?

I don’t want so set it to “first:100” because it would cost to much for the query. and even in this scenario it could possibly still have 101 lineitems.

Id rather not have to go through pagination of both the main query “order” and all nested arrays (lineitems, fulfillmentItems, .., …, …)

i just need to know i got the full order-details. and the ability to query more than 1 items at a time without blowing the cost.

The rest api gives me everything what i need without problems.
Am i missing somehting?

Best Regards
Nicolai

2 Likes

Hi there,

You aren’t missing anything its a conceptual thing. The costs are just different, for some things graphql is just so much better, but for others it takes a bit of getting used to, like requesting the first 10 line items and including the page info (hasNextPage, endCursor) so that if your result has a next page of line items you just get the next ten.

Ask yourself if you need all that information or are you just used to having it all in one go.. If you need all that information from the order like fulfilments, shippinglines, lineitems etc ect, then I would stick to the rest api for that purpose, because its ideally suited for that purpose. There is no rule that you can’t use a combination of both, at least I didn’t see any rulebook stating it, and if I did I promptly forgot or ignored it. Its a buffet of possibilities take what you like from the available options and leave the rest :slightly_smiling_face:

Cheers,

Gary

Or move to the bulk operation on which gets all data without having to specify first, etc.