2

I'm looking to cache all Fedex tracking information in my own database, and my company has around 150+ tracking numbers a day. According to this link,

http://www.fedex.com/us/developer/product/WebServices/MyWebHelp_August2010/Content/Proprietary_Developer_Guide/tTracking_and_Visibility_Services_condtionalized.htm

Fedex services do not support batch processing ? Does that mean I'd need to do single calls for every tracking number ? I took about 80 seconds for one days worth of sales doing it that way.

Is there no better option currently ? Or is there a better way or process for doing this ?

Munawir
  • 3,346
  • 9
  • 33
  • 51
Zork
  • 149
  • 1
  • 1
  • 11

2 Answers2

0

Use This Code Hope It Will Help You

TrackRequest request = CreateFedexMultipleTrackRequest(TrackingCode);
 TrackService service = new TrackService();
 TrackReply reply = service.track(request);
 if (reply.HighestSeverity == NotificationSeverityType.SUCCESS || reply.HighestSeverity == NotificationSeverityType.NOTE || reply.HighestSeverity == NotificationSeverityType.WARNING)
 {
   reply.CompletedTrackDetails//now manage All tracking As Your Need
 }
 //go to How to create single request for multiple tracking numbers at a time
 private static TrackRequest CreateFedexMultipleTrackRequest(string TrackingNumber)
    {
        //string[] str = new string[] {TrackingNumber};
        string[] staticIntArray = TrackingNumber.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
        //int arraycount = staticIntArray.Count();
        TrackRequest request = new TrackRequest();
        request.WebAuthenticationDetail = new WebAuthenticationDetail();
        request.WebAuthenticationDetail.UserCredential = new WebAuthenticationCredential();
        request.WebAuthenticationDetail.UserCredential.Key = Application.FedexKey;
        request.WebAuthenticationDetail.UserCredential.Password = Application.FedexPassword;
        request.WebAuthenticationDetail.ParentCredential = new WebAuthenticationCredential();
        request.WebAuthenticationDetail.ParentCredential.Key = Application.FedexKey;
        request.WebAuthenticationDetail.ParentCredential.Password = Application.FedexPassword;
        request.ClientDetail = new ClientDetail();
        request.ClientDetail.AccountNumber = Application.FedexAccountNumber;
        request.ClientDetail.MeterNumber = Application.FedexMeterNumber;
        request.TransactionDetail = new TransactionDetail();
        request.TransactionDetail.CustomerTransactionId = "NA";  //This is a reference field for the customer.  Any value can be used and will be provided in the response.
        request.Version = new VersionId();
        // Tracking information
        request.SelectionDetails = new TrackSelectionDetail[staticIntArray.Length];
        for (int j = 0; j <= staticIntArray.Length - 1; j++) { request.SelectionDetails[j] = new TrackSelectionDetail(); }
        for (int i = 0; i <= staticIntArray.Length - 1; i++)
        {
            request.SelectionDetails[i].PackageIdentifier = new TrackPackageIdentifier();
            request.SelectionDetails[i].PackageIdentifier.Value = staticIntArray[i]; //tracking number or door tag
            request.SelectionDetails[i].PackageIdentifier.Type = TrackIdentifierType.DOCUMENT_AIRWAY_BILL;
            request.SelectionDetails[i].ShipmentAccountNumber = "XXX";
            // Date range is optional.
            // If omitted, set to false
            request.SelectionDetails[i].ShipDateRangeBegin = DateTime.Parse("05/09/2016"); //MM/DD/YYYY
            request.SelectionDetails[i].ShipDateRangeEnd = request.SelectionDetails[0].ShipDateRangeBegin.AddDays(0);
            request.SelectionDetails[i].ShipDateRangeBeginSpecified = true;
            request.SelectionDetails[i].ShipDateRangeEndSpecified = true;
        }
        // Include detailed scans is optional.
        // If omitted, set to false
        request.ProcessingOptions = new TrackRequestProcessingOptionType[1];
        request.ProcessingOptions[0] = TrackRequestProcessingOptionType.INCLUDE_DETAILED_SCANS;
        return request;
    }

//you can Track 30 Numbers at a time in fedex

  • I'm looking for a method call in the API for tracking all packages for our account by date modified without specifying the tracking number. We want to integrate their package tracking with data on our side. – John May 11 '20 at 20:28
-1

Yes, you need to send each track as a separate request. Run it as a server-side process via a schedule, who cares how long it takes then!?

andyknas
  • 1,939
  • 2
  • 15
  • 29
  • This is what I concluded when I was doing this... I'll mark this as the anwser. – Zork Apr 25 '14 at 16:00
  • If it's something needed on the fly, you can use their website with a URL like https://www.fedex.com/apps/fedextrack/?action=track&trackingnumber=XXX,YYY,ZZZ&cntry_code=us&locale=en_US where X,Y,Z are tracking number digits – Milo LaMar Oct 10 '18 at 20:20