A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
I am attempting to extract order data on a monthly basis down to the line-item level. One piece of information I need for each line item is where it was fulfilled or is assigned to be fulfilled.
Due to the potentially large amount of data, the bulk operation to query the orders is ideal. However, those are limited to a maximum nesting of 2 levels. As far as I can determine, getting to the FulfillmentOrderLineItem level will require over 2 levels, eliminating my ability to use bulk operations in conjunction with orders of a date range.
My next attempt was to use a bulk operation in the following format:
Solved! Go to the solution
This is an accepted solution.
Hi Jpola12,
Your approach to using bulk operations feature in the GraphQL Admin API is indeed a good one for large datasets. Unfortunately, you're correct in that the bulk operation have a two-level limit on nesting. This limit is set to ensure the performance and stability of the Shopify platform.
For your specific need, you may need to perform multiple operations. One way to do this is to first fetch all orders using the bulk operations feature within your desired date range. From this operation, you can extract all order IDs.
In the second operation, you can use these order IDs to fetch the fulfillmentOrders for each order. While this does mean that you're making more queries, you are able to get detailed information about each order's fulfillment.
Unfortunately, the GraphQL API does not support filtering by date for the fulfillmentOrders
field. However, you can filter fulfillment orders by date in REST API using the created_at_min
and created_at_max
parameters.
As for pagination, GraphQL API provides a more efficient way to paginate results compared to REST. In GraphQL, you can use cursor-based pagination which is a more performant way to traverse larger sets of data.
Hope this helps!
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
This is an accepted solution.
Hi Jpola12,
Your approach to using bulk operations feature in the GraphQL Admin API is indeed a good one for large datasets. Unfortunately, you're correct in that the bulk operation have a two-level limit on nesting. This limit is set to ensure the performance and stability of the Shopify platform.
For your specific need, you may need to perform multiple operations. One way to do this is to first fetch all orders using the bulk operations feature within your desired date range. From this operation, you can extract all order IDs.
In the second operation, you can use these order IDs to fetch the fulfillmentOrders for each order. While this does mean that you're making more queries, you are able to get detailed information about each order's fulfillment.
Unfortunately, the GraphQL API does not support filtering by date for the fulfillmentOrders
field. However, you can filter fulfillment orders by date in REST API using the created_at_min
and created_at_max
parameters.
As for pagination, GraphQL API provides a more efficient way to paginate results compared to REST. In GraphQL, you can use cursor-based pagination which is a more performant way to traverse larger sets of data.
Hope this helps!
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Hi @Liam,
Thanks for your reply. I was hoping I was missing a faster approach, but I appreciate you confirming my findings.