Get last shipped orders for the date range using API

Hi,

I need to fetch the last shipped orders for the given date range and it’s shipment details from ShipHero using APIs.

Please do let me know if there is any API.

Thanks in Advance!
Supritha

Hi @supritha!
You could use a query like this:

query {
  shipments(date_from: "2021-01-13", date_to: "2021-01-15") {
    request_id
    complexity
    data(first: 10) {
      edges {
        node {
          id
          legacy_id
          order_id
          user_id
          warehouse_id
          pending_shipment_id
          profile
          picked_up
          needs_refund
          refunded
          delivered
          dropshipment
          shipped_off_shiphero
          completed
          created_date
          line_items(first: 10) {
            edges {
              node {
                id
                quantity
                shipping_label_id
              }
            }
          }
          shipping_labels {
            label {
              pdf_location
            }
            tracking_number
            created_date
          }
        }
      }
    }
  }
}

Using the time range that you need.
There might be fields you want to remove or add, but for all the fields you can see them by navigating through the schema & docs if needed

Let me know if there is anything else I could help you with,
Thanks in advance!
Tom

Thanks for the reply, @tomasw !

Is there a way to get order number in the shipments API?

Regards,
Supritha

Absolutely @supritha !
You can include the

 order{
            order_number
          }

Field, something like:

query {
  shipments(date_from: "2021-01-13", date_to: "2021-01-15") {
    request_id
    complexity
    data(first: 10) {
      edges {
        node {
          id
          legacy_id
          order_id
          user_id
          warehouse_id
          pending_shipment_id
          profile
          picked_up
          needs_refund
          refunded
          delivered
          dropshipment
          shipped_off_shiphero
          completed
          created_date
          order{
            order_number
          }
          line_items(first: 10) {
            edges {
              node {
                id
                quantity
                shipping_label_id
              }
            }
          }
          shipping_labels {
            label {
              pdf_location
            }
            tracking_number
            created_date
          }
        }
      }
    }
  }
}

Thanks again!
Tom

That would be helpful.

thanks for the reply, @tomasw !

Regards,
Supritha

1 Like