简体   繁体   English

CreateInboundShipmentPlan的Amazon MWS API地址格式

[英]Amazon MWS API Address format for CreateInboundShipmentPlan

Using the Ruby Gem - Peddler to access the MWS API. 使用Ruby Gem- Peddler访问MWS API。 We have to send the ship from address. 我们必须从地址发送船。 The documentation says it needs to be a hash, but I can't get this to work.. 文档说它必须是一个哈希,但是我无法使它正常工作。

ship_from_address = {
  name: "Schmo",
  addressline1: "929 Whatever Dr.",
  city: "Fun Town",
  stateorprovincecode: "XX",
  postalcode: "12345"
}

And here is the actual call to the API with the client setup correctly, because I can access other data where the request is more simple.. 这是正确设置了客户端设置后对API的实际调用,因为我可以访问请求更简单的其他数据。

plan = client.create_inbound_shipment_plan(ship_from_address,    
  inbound_shipment_plan_request_items)

And here is the link to the amazon documentation .. 这是亚马逊文档的链接..

This is what the format of the address field looks like when I request it from the API.. 这是我从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"}}}

Any ideas? 有任何想法吗?

It seems like you need to stick to conventions of naming keys in the hash. 似乎您需要遵守哈希中命名键的约定。 The keys of the hash are converted to uppercase, so addressline1 will become Addressline1 , but it should be AddressLine1 . 哈希键将转换为大写,因此addressline1将变为Addressline1 ,但应为AddressLine1 Try to rename the keys like so: 尝试像这样重命名密钥:

ship_from_address = {
  name: "Schmo",
  address_line_1: "929 Whatever Dr.",
  city: "Fun Town",
  state_or_province_code: "XX",
  postal_code: "12345"
}

Pay attention to how keys are named in specs of Peddler gem – https://github.com/hakanensari/peddler/blob/master/test/integration/test_fulfillment_inbound_shipment.rb#L5 I think this the cause of the problem. 请注意在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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM