我想使用 UPS 的 API 进行虚拟 REST 调用来生成测试假货件请求。
我正在遵循有关运输包裹的 REST UPS 文档:
https://www.ups.com/upsdeveloperkit/downloadresource?loc=en_US
第 116 页显示了客户端应用程序创建 cargo 并获得带有 cargo 标签的成功响应的示例。我想重新创建它,因此我尝试将一些虚假数据发布到 TEST URL 地址:
https://wwwcie.ups.com/ship/v1/shipments
我发出请求(包含 header 和正文信息),但我不断收到错误代码 120100(托运人编号缺失或无效)。
很多论坛帖子都说这与我的 UPS 帐户上没有设置地址有关,但我的帐户上已经设置了地址,我只想向 TEST URL 发出虚假请求端点。
这是请求的正文:
{
"ShipmentRequest":{
"Shipment":{ "Description":"1206 PTR", "Shipper":{
"Name":"ShipperName", "AttentionName":"AttentionName", "TaxIdentificationNumber":"TaxID", "Phone":{
"Number":"1234567890" },
"ShipperNumber":"ShipperNumber", "Address":{
"AddressLine":"AddressLine", "City":"City", "StateProvinceCode":"STD", "PostalCode":"PostalCode", "CountryCode":"EN"
} },
"ShipTo":{
"Name":"ShipToName", "AttentionName":"AttentionName", "Phone":{
"Number":"1234567890" },
"FaxNumber":"1234567999", "TaxIdentificationNumber":"456999", "Address":{
"AddressLine":"AddressLine", "City":"City", "StateProvinceCode":"STD", "PostalCode":"PostalCode", "CountryCode":"EN"
} },
"ShipFrom":{ "Name":"ShipperName", "AttentionName":"AttentionName", "Phone":{
"Number":"1234567890" },
"FaxNumber":"1234567999", "TaxIdentificationNumber":"456999", "Address":{
"AddressLine":"AddressLine", "City":"City",
"StateProvinceCode":"STD", "PostalCode":"PsotalCode", "CountryCode":"EN"
} },
"PaymentInformation":{ "ShipmentCharge":{
"Type":"01", "BillShipper":{
"AccountNumber":"AccountNumber" }
} },
"Service":{
"Code":"01", "Description":"Expedited"
},
"Package":[{ "Description":"International Goods", "Packaging":{
"Code":"02" },
"PackageWeight":{ "UnitOfMeasurement":{
"Code":"LBS" },
"Weight":"10" },
"PackageServiceOptions":"" },
{
"Description":"International Goods", "Packaging":{
"Code":"02" },
"PackageWeight":{ "UnitOfMeasurement":{
"Code":"LBS" },
"Weight":"20" },
"PackageServiceOptions":"" }]
, "ItemizedChargesRequestedIndicator":"", "RatingMethodRequestedIndicator":"", "TaxInformationIndicator":"", "ShipmentRatingOptions":{
"NegotiatedRatesIndicator":"" }
}, "LabelSpecification":{
"LabelImageFormat":{ "Code":"GIF"
} }
} }
最佳答案
我通过查找与 UPS 开发者帐户关联的发件人编号(帐号)解决了此问题。
关于api - UPS 运输 REST API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62122311/