api - UPS 运输 REST API

标签 api rest restful-url ups

我想使用 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/

相关文章:

java - MS Edge 显示文件来源为 "about:blob"

rest - 如何避免在具有深度链接的 RESTful 客户端/服务器 Web 应用程序中对 URL 进行硬编码?

node.js - Jasper Rest API,运行报告

rest - 如何使用angularjs资源处理分页和计数?

rest - 使用 POST 作为 UPDATE 或 CREATE 时是否违反了 RESTfulness

具有任意数量过滤条件的搜索服务的 RESTful URL

api - 构建 API key 和访问 token

api - 使用 Quip API,如何获取所有线程的列表?

node.js - 如何在通过 Vuejs 调用时使 Nodejs 重定向工作

api - Oauth 2.0 是否需要消费者 key /消费者 secret