Cannot query field "tracking_number" on type "Shipment"

Is there really no “tracking_number” that can be included with a “shipment”? This seems like one of the more important properties of a shipment. Geesh.

How do you otherwise get the tracking numbers for each line item on an order?

For example: Given the ShipHero order id, how do you query/drill-down to get the tracking number for each LineItem on the order?

Hi @bbarrett!
That field should be under shipping_labels, as it is assigned to a label, something like this

query {
  shipment(id: "95544424") {
    request_id
    complexity
    data {
      shipping_labels {
        tracking_number
      }
    }
  }
} 

Let me know if that is not what you were referring to.
Thanks in advance!
Tom

Thanks! Ill give it a shot

How would you recommend getting each Order LineItem’s tracking number?

For example, I will start with the ShipHero Order id. I then need to query into an order object and collect each shipped lineitem with its tracking number. There does not seem to be an obvious way to accomplish this

Thanks!

In that case, you could get the line items from a label and the tracking number, for every shipment on an order.

Something like this:

query {
  order(id: "142907492") {
    request_id
    complexity
    data {
      shipments {
        id
        shipping_labels {
          tracking_number
          shipment_line_items(first:10) {
            edges {
              node {
                id
                line_item {
                  sku
                }
              }
            }
          }
        }
      }
    }
  }
}

The line item section is if you need the sku, but if you can use the id, then you can avoid sending that part.
Let me know if this is not what you were looking for,
Thanks!
Tom

Thanks! This request does work. However, in my tests I am always getting an empty collection for shipping_labels. I need to find an order that I know has shipped to confirm.

This is working for me. Thanks again!

1 Like

Hi @bbarrett @tomasw were you able to also retrieve the shipped quantity associated with each SKU on a tracking number? For example, if an SKU was shipped across two packages (5 units in one and 3 units in the other), were you able to determine the quantity in each package? I added “quantity_shipped” to the query but it is only returning the total quantity on the order shipped, not the quantity shipped per package.

Hi @isaac.wyatt!
For that you can add the quantity field under the line item id, this is

query {
  order(id: "142907492") {
    request_id
    complexity
    data {
      shipments {
        id
        shipping_labels {
          tracking_number
          shipment_line_items(first:10) {
            edges {
              node {
                id
                quantity
                line_item {
                  sku
                }
              }
            }
          }
        }
      }
    }
  }
} 

Let me know if that doesn’t help
Thanks!
Tom