A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
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
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 🙂
Cheers,
Gary
Or move to the bulk operation on which gets all data without having to specify first, etc.