I am are trying to find out how many items are tied to each shipping label for a shipment, this data is used for a task that is run daily.
If we add a query for shipment line items the complexity goes through the roof and our daily job gets IMMENSELY more complicated (We have to handle querying for more shipments, more shipment line items on each shipment IFF there’s more than the initial request amount, along with API credit limits and timeouts.
We do not need to know every product that was shipped, only how many items were shipped with each shipping label. Is there a more efficient way to go about this?
Our current query looks like this:
query{
shipments(date_from: "yyyy-yy-yy", date_to: "xxxx-xx-xx"){
complexity
request_id
data(first: 100){
pageInfo{
hasNextPage
endCursor
}
edges {
node {
id
created_date
profile
user_id
warehouse_id
shipped_off_shiphero
order{
rma_labels{
shipment_id
}
returns{
id
status
reason
}
account_id
id
}
shipping_labels{
created_date
shipping_method
warehouse
source
warehouse_id
address{
address1
address2
country
city
state
zip
}
dimensions{
weight
height
width
length
}
shipment_line_items(first: 10){
edges{
node{
quantity
}
}
}
}
}
}
}
}
}