3PL Client Account | Can't pull order by order_number

I have an order number 70614 that was created using client account, and can be seen in the webUI under client account, but gives me an error when I try to query it via API.
Could you pls help?

My Query:
{"query":"{ order(order_number: \"70614\") { request_id complexity data { id legacy_id order_number shop_name fulfillment_status order_date profile required_ship_date shipping_lines { carrier method price } shipping_address { first_name last_name address1 address2 city state state_code zip country } tags line_items(first: 2) { edges { node { id sku quantity product_name fulfillment_status quantity_allocated backorder_quantity barcode } cursor } } shipments { id order_id user_id warehouse_id address { name address1 address2 city state country zip } shipped_off_shiphero dropshipment } returns { id reason status } }}}"}

Error:
{"errors":[{"message":"Unknown argument \"order_number\" on field \"order\" of type \"Query\".","locations":[{"line":1,"column":9}]},{"message":"Field \"order\" argument \"id\" of type \"String!\" is required but not provided.","locations":[{"line":1,"column":3}]}]}

For the order query you will need to enter the order id, not the order number:

query{
  order(id: "<order_id here>" ){
    request_id
    complexity
    data{
      id
      legacy_id
      order_number
      shop_name
      fulfillment_status
    }
  }
}

The id is the number in the UI URL
image

Thank you Theresa - and sorry about the delay in replying, I never got the email notification this time, I actually logged in to gently bump the topic haha

Okay so using the shiphero generated id is the only way to pull an order? There’s no field where I could put the 70614 while creating that order to be able to pull using that?
Just wanted to be sure there’s no way around it before I go down the route of changing things to accommodate this restriction.

Sorry to bug you again - but could you please confirm this?
Thank you

Hi Raj,
Order query takes the order id but the orders query takes the order number:

 orders(order_number: "<insert order number here>") {
    data {
      edges {
        node {
          partner_order_id
         shipments{
          shipping_labels{
            tracking_number
          }
        }
        }
      }
    }
    request_id
    complexity
  }
}

Hi Theresa,
Initially I thought this is exactly what I needed! But been trying several things for 2 days but the Shipments section is always blank for me:

{"data":{"orders":{"data":{"edges":[{"node":{"partner_order_id":"105359","shipments":[]}}]},"request_id":"614cce2cb622f830ae3eb580","complexity":101}}}

{"data":{"orders":{"data":{"edges":[{"node":{"partner_order_id":"105349","shipments":[{"shipping_labels":[{"tracking_number":"12345678"}]}]}}]},"request_id":"614cce81d0ad6be51b3b59b0","complexity":101}}}

What might be the reason?

Hi Raj,
In that request 614cce2cb622f830ae3eb580, the only data that you are returning is the information of the shipment. The order id 105359 does not have any shipments and that is why it is coming back empty. I added store name to the data to be returned and it worked great.

Actually Shipment is the only data I’m trying to pull right now. As these are just sample test orders, my associate and I tried adding dummy shipment (with your colleague Kevin’s help) but still no luck pulling that data - I’m sure we’re missing something.
Are you able to enter some dummy shipment data including tracking number from backend into this order? If I’m able to see it here via my query, I’ll just learn what we need to do to enter these the right way with future orders.

We can do one in the ui ( a dummy shipment ) want me to put one in?

Yes please!
thank you!

Try 105349, there was probably miscommunication on which one Kevin put in. 105349 does have a shipment and the tracking comes up fine with the query

Yess! it works! Thank you so much!!
{"data":{"orders":{"data":{"edges":[{"node":{"partner_order_id":"105349","shipments":[{"shipping_labels":[{"tracking_number":"12345678"}]}]}}]},"request_id":"614ceee769a8f9265fa7b3aa","complexity":101}}}

I know it just has minimum dummy data here right now, but could this section also show the carrier and method details pls?

1 Like

Sorry Theresa, I missed tagging you with my last reply - I guess you don’t receive a notification in that case

Yes!

query {
  orders(order_number:"105359") {
    data {
      edges {
        node {
          shipments {
            shipping_labels {
              tracking_number
              carrier
              shipping_method
              order_number
            }
          }
        }
      }
    }
  }
}

YESS! Thank you so much Theresa, this is perfect!! :star_struck:

1 Like