How to Import Tracking Codes

Hi Everyone:

Is there a way in the API to import the tracking URL? https://www.screencast.com/t/QaX8qscoXcJK

Thanks,
Brad

HI @mazdamx!
If you use a valid carrier (for example UPS) and with the shipment_create mutation, in the label, you can specify the tracking number and it should be linked to UPS URL.
For example, I used this mutation and it worked:

mutation {
  shipment_create(
    data: {
      address: {
        name: "Tom Test"
        address1: "add1"
        city: "NY"
        zip: "10920"
        country: "US"
        state: "NY"
      }
      line_items: { line_item_id: "<LINE ITEM ID>", quantity: 1 }
      order_id: "<ORDER ID>"
      warehouse_id: "<WAREHOUSE ID>"
      labels: {
        dimensions: {
          weight: "1.00"
          height: "1.00"
          width: "1.00"
          length: "1.00"
        }
        carrier: "UPS"
        shipping_name: "Custom Status"
        shipping_method: "UPS Ground"
        cost: "0.00"
        line_item_ids: "<LINE ITEM ID>"
        address: {
          name: "Tom Test"
          address1: "add1"
          city: "NY"
          zip: "10920"
          country: "US"
          state: "NY"
        }
        label: {
          pdf_location: "<PDF OF THE LABEL>"
        }
        tracking_number: "123456789"
      }
    }
  ) {
    request_id
    complexity
  }
}

And when I did this, the tracking number got linked to the USP Tracking site.
Let me know if this works for you,
Thanks!
Tom

OK we will give it a shot. Thank you Tom!!

Tom, what we actually want is send a customer his shipment tracking URL. So how can we query that URL via API. Is it possible to query only tracking number (and we have to compose URL depending on the carrier we use) or you can query also URL?

@mazdamx you can only get the tracking number by querying for the desired shipment.

query {
  shipment(id: "xxx") {
     request_id
     complexity
     data {
         order_id
         shipping_labels {
             carrier
             tracking_number
         }
     }
  }
}

OK we will try that. Thank you for the quick response!