在一个请求中获取所有服务的费率
Get rates for all services in one request
问题
是否可以在同一请求中获取所有可能的 ups 服务的费率?
背景
尽管 UPS 费率文档指出 service
元素是可选的
具有 service
元素定义的请求成功响应,而没有定义元素的请求导致以下错误:
["Error"]=>
array(3) {
["ErrorSeverity"]=>
string(4) "Hard"
["ErrorCode"]=>
string(6) "111100"
["ErrorDescription"]=>
string(58) "The requested service is invalid from the selected origin."
}
此外,我见过的每个示例和库要么只希望为一种类型的服务创建请求,要么 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
总结
有没有办法 return 为我缺少的所有 UPS 服务定价,或者我们必须向 UPS 查询我们希望获得费率的每项服务?
您应该能够通过将 /RateRequest/Request/RequestOption
设置为 Shop
并省略 /RateRequest/Shipment/Service
元素来接收多项服务的费率。
UPS 的 Rate Webservice 端点文档对此进行了概述:
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.
问题
是否可以在同一请求中获取所有可能的 ups 服务的费率?
背景
尽管 UPS 费率文档指出 service
元素是可选的
具有 service
元素定义的请求成功响应,而没有定义元素的请求导致以下错误:
["Error"]=>
array(3) {
["ErrorSeverity"]=>
string(4) "Hard"
["ErrorCode"]=>
string(6) "111100"
["ErrorDescription"]=>
string(58) "The requested service is invalid from the selected origin."
}
此外,我见过的每个示例和库要么只希望为一种类型的服务创建请求,要么 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
总结
有没有办法 return 为我缺少的所有 UPS 服务定价,或者我们必须向 UPS 查询我们希望获得费率的每项服务?
您应该能够通过将 /RateRequest/Request/RequestOption
设置为 Shop
并省略 /RateRequest/Shipment/Service
元素来接收多项服务的费率。
UPS 的 Rate Webservice 端点文档对此进行了概述:
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.