亚马逊 MWS API CreateInboundShipmentPlan 的地址格式
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)
这里是 link 到 amazon documentation..
这是我从 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 我认为这是问题的原因。
使用 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)
这里是 link 到 amazon documentation..
这是我从 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 我认为这是问题的原因。