Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get rates for all services in one request

Tags:

ups

Question

Is it possible to get rates for all possible ups services in the same request?

Background

Although the UPS rates documentation states that the service element is optional proof of optionality

Requests with the service element defined respond successfully while requests without the element defined result in the following error:

["Error"]=>
array(3) {
  ["ErrorSeverity"]=>
  string(4) "Hard"
  ["ErrorCode"]=>
  string(6) "111100"
  ["ErrorDescription"]=>
  string(58) "The requested service is invalid from the selected origin."
}

Additionally, every example and library i've seen either only desired to create requests for one type of service or creates a request for each service the user specifies they want to receive:

// optional, you can specify which rates to look for -- performs multiple requests, so be careful not to do too many

In Summary

Is there a way to return rates for all services from UPS that I am missing or must we query UPS for each service we wish to get a rate for?

like image 673
Ulad Kasach Avatar asked Sep 17 '25 22:09

Ulad Kasach


1 Answers

You should be able to receive rates for multiple services by setting the /RateRequest/Request/RequestOption to Shop and omitting the /RateRequest/Shipment/Service element.

This is outlined in UPS's documentation for the Rate Webservice endpoints:

Can a customer compare services for a shipment using the Rating API?

Yes. Use the “Shop” value, instead of the “Rate” value, in the RequestOption element of the ../Request container to retrieve the rates for all services for the stated lane pair. The API response will return a rate for each of the available services. This is known as the Shop option.

like image 127
Noah Freitas Avatar answered Sep 23 '25 13:09

Noah Freitas