rateups

UPS Rates API - how to get service description


I am building a shipping rates calculator and I need the service code, description and price from the API response. I have noticed that I never get a response for: /RatingServiceSelectionResponse/RatedShipment/Service/Description - but I get a response for the price and service code.

I contacted support about this and they said:

" Unfortunately, the description for the service (inside of the response) is only available in our Time in Transit API"

This seems very strange to have an Rates API that does not provide the service descriptions, it seems a bit useless without this info.

Does anyone know if there any way to do a lookup for the service description using the service code that is brought back from the Rates API?

Any help with this would be much appreciated.


Solution

  • The codes are found in Appendix E of the Rating Package Web Services Developers Guide.

    I've had similar frustration with the UPS API's.
    You're right - the ...Service/Description is blank in the Rate service's response. So, you have to go with the ...Service/Code value and write your own code-description map based on those codes.

    For example, here are the values I mapped out in a Perl script:

    %ups_service_code   = (
        '01'    => 'UPS Next Day Air',
        '02'    => 'UPS 2nd Day Air',
        '03'    => 'UPS Ground',
        '07'    => 'UPS Worldwide Express',
        '08'    => 'UPS Worldwide Expedited',
        '11'    => 'UPS Standard',
        '12'    => 'UPS 3 Day Select',
        '13'    => 'UPS Next Day Air Saver',
        '14'    => 'UPS Next Day Air Early A.M.',
        '54'    => 'UPS Worldwide Express Plus',
        '59'    => 'UPS 2nd Day Air A.M.',
        '65'    => 'UPS Saver',
        ## 82-86 are Polish Domestic Shipments
        '82'    => 'UPS Today Standard',
        '83'    => 'UPS Today Dedicated Courier',
        '84'    => 'UPS Today Intercity',
        '85'    => 'UPS Today Express',
        '86'    => 'UPS Today Express Saver'
    );
    

    Now, what's REALLY frustrating is that when you implement the TimeInTransit (TNT) service, you find that it returns the descriptions but no codes!
    But what I found is that the descriptions returned by the TNT service match the descriptions of the Rate codes from the developer guide (in example above). So, that's the way I've ended up matching TNT data with Rate data.

    Hope this helps!

    UPDATE:
    For TransitInTime request you can find the codes in the Time in Transit documentation look at the end of the PDF section "Service Codes". This codes anyway are different from the ones used in the rate so you have to create another map for that.

    This is an example

    /* Mapping for destination within the origin country */
            $SCmappings = array(
                '23' => '54',   /* UPS Express Plus                     */
                '24' => '07',   /* UPS Express                          */
                '25' => '11',   /* UPS Standard                         */
                '26' => '65',   /* UPS Express Saver                    */
                '39' => '70'    /* UPS Access Point Economy             */
            );
    
            /* Mapping for destination within the European Union */
            $EUmappings = array(
                '08' => '11',   /* UPS Standard                         */
                '10' => '07',   /* UPS Express                          */
                '18' => '65',   /* UPS Express Saver                    */
                '22' => '54',   /* UPS Express Plus                     */
                '29' => '08',   /* UPS Express Freight - UPS Expedited  */
                '39' => '70'    /* UPS Access Point Economy             */
            );
    
            /* Mapping for destination outside the European Union */
            $nonEUmappings = array(
                '01' => '07',   /* UPS Worldwide Express                */
                '05' => '08',   /* UPS Worldwide Expedited              */
              //  '11' => '???',   /* UPS Express NA 1                     */
                '21' => '54',   /* UPS Worldwide Express Plus           */
                '28' => '65',   /* UPS Worldwide Express Saver          */
                '29' => '11',   /* UPS Express Freight - UPS Standard   */
                '39' => '70'    /* UPS Access Point Economy             */
            );