getting all fulfillments of an order graphQL

MincSD
Visitor
2 0 0

Hi,

i am trying to get all fulfillments of 1 order via GraphQL.

In REST there is the endpoint to get all fulfillments of 1 Order, but in GraphQL i cannot query the fulfillments by OrderID it seems.

 

I tried to solve this by querying the order and then getting the fulfillments from there, but the problem i am facing there is that there is no cursor on the fulfillments object on the order. So you could in theory have too much items there and filling in a high number for pagination will a) never give you certainty to get all fulfillments and b) be more expensive then necessary .

 

The only way i could find till now was to get all fulfillmentOrders and then from all fulfillmentOrders get all fulfillments since pagination is possible there.

However even this way is not entirely optimal since you cannot query the fulfillmentOrders by order either and you have to go via the order again, whereas in REST this is simply reachable by querying the right endpoint.

 

Is this by accident not properly documented or is it simply not possible to do differently.

 

Btw i am checking API 2021-10 as of now.

 

 

Reply 1 (1)

chipak1981
Tourist
4 1 0

I suggest trying the bulk ops API - https://shopify.dev/api/usage/bulk-operations/queries

and maybe this sample query will help you get started with it:

{
  orders(id:{your_id}) { 
    edges { 
      node {
        fulfillments {
          id
        }
        fulfillmentOrders {
          edges {
            node {
              id
            }
          }
        }
    }
  }
}
}