Common Input / Output Tracking

With SupremeTracking you can track many different tracking numbers at once. All you need to do is set authentication information to each shipper and add tracking numbers to request. As an option there is boolean flag AllTrackAtOnce. This option is very useful if you are sure that tracking numbers’ values are correct. But there is a trap with this as some shipping providers will not send you any response if only one tracking number is incorrect. We strongly recommend to leave this flag set by default to False. Example of tracking:

 

 

Here is what you need to include: 

 

using System;

using System.Collections.Generic;

using SupremeShipping.Objects;

using SupremeShipping.DHL;

using SupremeShipping.USPS;

using SupremeShipping.UPS;

using SupremeShipping.FedEx;

using SupremeShipping.Errors;

 

Make an instance of track manager and set authorization information for each shipper. 

 

TrackProvider track = new TrackProvider ();

track.DHLAuthTicket = new DHLAuthTicket("your user id", "your password");

track.USPSAuthTicket = new USPSAuthTicket("your user id", "your password");

track.FedExAuthTicket = new FedExAuthTicket("your customer transaction id", "your account number",

"your meter number");

track.UPSAuthTicket = new UPSAuthTicket("your access license number", "your user id", "your password");

 

 

Make an instance of track request. Add tracking number to tracking request. Typed tracking of all shippers’ numbers is allowed here as authorization information for all of the carriers has been set earlier.

 

TrackRequest request = new TrackRequest();

 

request.TrackingNumbers.Add("DHL track");

request.TrackingNumbers.Add("another DHL track");

request.TrackingNumbers.Add("and track for the rest");

track.Request = request; 

 

Check for tracking response. 

 

TrackResponseCollection response = track.Check();

Check for response errors. 

if (response.Errors != null && response.Errors.Count > 0)

        foreach (Error error in response.Errors)

        {

                string errrorCode = error.ErrorCode;

                string description = error.Description;

                string details = error.Details;

        }

 

 

 

TrackResponse contains information related to provider.

foreach (TrackResponse trackResponse in response)

        /* some info about this response */

        string provider = trackResponse.Provider.ToString();

 

        string serviceDescription = trackResponse.ServiceDescription;

        /* when and where shipment was */

        DateTime whenDeliverd = trackResponse.Summary.DeliveredDate;

        string whereDelivered = trackResponse.Summary.DeliveredLocation;

        /* some details about shipemnt history*/

        foreach (TrackEvent trackEvent in trackResponse.Events)

        {

                DateTime when = trackEvent.Date;

                Address where = trackEvent.Location;

                string whatHappend = trackEvent.Description;

        }