![](/img/trans.png)
[英]Rails Peddler gem: Using Amazon MWS Feeds API for adding products to Amazon seller central store
[英]Amazon MWS API Address format for CreateInboundShipmentPlan
使用Ruby Gem- Peddler访问MWS API。 我们必须从地址发送船。 文档说它必须是一个哈希,但是我无法使它正常工作。
ship_from_address = {
name: "Schmo",
addressline1: "929 Whatever Dr.",
city: "Fun Town",
stateorprovincecode: "XX",
postalcode: "12345"
}
这是正确设置了客户端设置后对API的实际调用,因为我可以访问请求更简单的其他数据。
plan = client.create_inbound_shipment_plan(ship_from_address,
inbound_shipment_plan_request_items)
这是亚马逊文档的链接..
这是我从API请求地址字段时的格式。
{"ShipmentData"=>{"member"=>{"LabelPrepType"=>"SELLER_LABEL",
"DestinationFulfillmentCenterId"=>"IND2", "ShipFromAddress"=>
{"City"=>"XXX", "CountryCode"=>"XX", "PostalCode"=>"12345",
"Name"=>"Schmo", "AddressLine1"=>"3434 Smitherens Rd.",
"StateOrProvinceCode"=>"YY", "AddressLine2"=>"#13A"},
"ShipmentId"=>"FBA37ZLXXX", "AreCasesRequired"=>"false",
"ShipmentName"=>"2015-12-22 09:58", "ShipmentStatus"=>"IN_TRANSIT"}}}
有任何想法吗?
似乎您需要遵守哈希中命名键的约定。 哈希键将转换为大写,因此addressline1
将变为Addressline1
,但应为AddressLine1
。 尝试像这样重命名密钥:
ship_from_address = {
name: "Schmo",
address_line_1: "929 Whatever Dr.",
city: "Fun Town",
state_or_province_code: "XX",
postal_code: "12345"
}
请注意在Peddler gem的规范中如何命名密钥-https: //github.com/hakanensari/peddler/blob/master/test/integration/test_fulfillment_inbound_shipment.rb#L5我认为这是问题的原因。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.