UPS追踪API未返回postalCode与Weight,请求排查原因
问题背景
根据UPS官方文档,调用getSingleTrackResponseUsingGET接口时,响应应包含postalCode(目的地邮编)和Weight(包裹重量)字段,但实际执行请求后,这两个字段并未出现在返回结果中。
实际执行的请求命令
curl -i -X GET \ 'https://onlinetools.ups.com/api/track/v1/details/1Z0088XW0360412370?locale=en_US&returnSignature=true' \ -H 'Authorization: Bearer ......' \ -H 'Content-Type: application/json' \ -H 'transId: test123' \ -H 'transactionSrc: prod'
实际获取的响应内容
{"trackResponse":{"shipment":[{"inquiryNumber":"1Z0088XW0360412370","package":[{"trackingNumber":"1Z0088XW0360412370","deliveryDate":[{"type":"DEL","date":"20230405"}],"deliveryTime":{"type":"DEL","endTime":"113010"},"activity":[{"location":{"address":{"city":"NORTH HIGHLANDS","stateProvince":"CA","countryCode":"US","country":"US"},"slic":"9581"},"status":{"type":"D","description":"DELIVERED ","code":"9E","statusCode":"011"},"date":"20230405","time":"113010"},{"location":{"address":{"city":"West Sacramento","stateProvince":"CA","countryCode":"US","country":"US"},"slic":"9581"},"status":{"type":"I","description":"Out For Delivery Today","code":"OT","statusCode":"021"},"date":"20230405","time":"092430"},{"location":{"address":{"city":"West Sacramento","stateProvince":"CA","countryCode":"US","country":"US"},"slic":"9589"},"status":{"type":"I","description":"Processing at UPS Facility","code":"YP","statusCode":"071"},"date":"20230405","time":"043623"},{"location":{"address":{"city":"West Sacramento","stateProvince":"CA","countryCode":"US","country":"US"},"slic":"8959"},"status":{"type":"I","description":"Arrived at Facility","code":"AR","statusCode":"005"},"date":"20230405","time":"021100"},{"location":{"address":{"city":"Sparks","stateProvince":"NV","countryCode":"US","country":"US"},"slic":"8959"},"status":{"type":"I","description":"Departed from Facility","code":"DP","statusCode":"005"},"date":"20230404","time":"235100"},{"location":{"address":{"city":"Sparks","stateProvince":"NV","countryCode":"US","country":"US"},"slic":"8959"},"status":{"type":"I","description":"Origin Scan","code":"OR","statusCode":"005"},"date":"20230404","time":"204555"},{"location":{"address":{"countryCode":"US","country":"US"}},"status":{"type":"M","description":"Shipper created a label, UPS has not received the package yet. ","code":"MP","statusCode":"003"},"date":"20230405","time":"022029"}],"currentStatus":{"description":"Delivered","code":"011"},"packageAddress":[{"type":"ORIGIN","address":{"city":"SPARKS","stateProvince":"NV","countryCode":"US","country":"US"}},{"type":"DESTINATION","address":{"city":"NORTH HIGHLANDS","stateProvince":"CA","countryCode":"US","country":"US"}}],"service":{"code":"518","levelCode":"003","description":"UPS Ground"},"packageCount":6}]}]}}
疑问
为什么响应里没有返回postalCode和Weight字段?是不是请求时漏掉了必要的参数?
内容的提问来源于stack exchange,提问作者binbin

