UPS发货REST API

问题描述 投票:0回答:1

我想使用UPS的API进行一个虚拟的REST调用来生成一个测试的假货请求。

我正在按照REST UPS文档中的发货包进行操作。

https://www.ups.com/upsdeveloperkit/downloadresource?loc=en_US

第116页显示了一个客户端应用程序创建一个货件并得到一个带有运输标签的成功响应的例子。我想重新创建这个例子,所以我尝试向TEST URL地址POST一些假数据。

https://wwwcie.ups.com/ship/v1/shipments

我提出了请求(有头和主体信息),但我一直收到错误代码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"
} }
} }
api rest restful-url shipping ups
1个回答
0
投票

我通过找到链接到UPS开发者账户的Shipper Number(账号)来解决这个问题。

© www.soinside.com 2019 - 2024. All rights reserved.