在亚马逊 MWS 上创建出库货件时出现签名错误 API

Error with signature when creating an outbound shipment on Amazon MWS API

我正在尝试在亚马逊 MWS API 上创建出站履行 (CreateFulfillmentOrder)。我正在使用 node.js 包 mws-api 发出请求,我已经修改了自己的请求,因为它不正确支持此操作。无论如何,这正是我发送给 API 的请求(敏感信息已更改):

{ 
 uri: 'https://mws.amazonservices.co.uk/FulfillmentOutboundShipment/2010-10-01',
 method: 'POST',
 headers:
  { Host: 'mws.amazonservices.co.uk',
    'User-Agent': 'mws-api/0.1.0 (Language=JavaScript)',
    'content-type': 'application/x-www-form-urlencoded',
    'content-length': 1095 },
 body: 'SellerFulfillmentOrderId=403-9883411-3564317&ShippingSpeedCategory=Standard&DisplayableOrderId=403-9883411-3564317&DisplayableOrderDateTime=2013-12-29&DisplayableOrderComment=Order&NotificationEmailList.member.1=3yv4at7rtl3blsy%40marketplace.amazon.co.uk&DestinationAddress.Name=Amazon%20Taro&DestinationAddress.Line1=COMPANY%NAME&DestinationAddress.City=GORING&DestinationAddress.StateOrProvinceCode=Oxon&DestinationAddress.PostalCode=RG8%209AQ&DestinationAddress.CountryCode=GB&DestinationAddress.PhoneNumber=01575375219&Items.member.1.DisplayableComment=item&Items.member.1.GiftMessage=gift&Items.member.1.PerUnitDeclaredValue.Value=4.29&Items.member.1.PerUnitDeclaredValue.CurrencyCode=GBP&Items.member.1.Quantity=1&Items.member.1.SellerFulfillmentOrderItemId=CW0298&Items.member.1.SellerSKU=CW0298&Action=CreateFulfillmentOrder&Version=2010-10-01&Timestamp=2017-04-12T14%3A39%3A22.707Z&AWSAccessKeyId=LYIAJ83AORVSI6WLBTQA&SellerId=7RVB74LQNDFDB1&SignatureMethod=HmacSHA256&SignatureVersion=2&Signature=nlB5UTDUXexkurlsc7e%2F4tqLO8vcMRy4X%6Oa0rPIapZN8%3D' }

但我得到的回应是这个错误:

The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.

我没发现签名有任何问题,它在进行其他操作时工作正常。我认为这只是亚马逊在请求出现问题时给你的错误,但我找不到问题所在。有谁知道可能是什么问题?

谢谢。

您需要使用亚马逊主机mws.amazonaws.com.

例如:

    { 
     uri: 'https://mws.amazonaws.com/FulfillmentOutboundShipment/2010-10-01',
     method: 'POST',
     headers:
      { Host: 'mws.amazonaws.com',
            'User-Agent': 'mws-api/0.1.0 (Language=JavaScript)',
            'content-type': 'application/x-www-form-urlencoded',
        'content-length': 1095 
       },
       body:'SellerFulfillmentOrderId=403-9883411-3564317&ShippingSpeedCategory=Standard&DisplayableOrderId=403-9883411-3564317&DisplayableOrderDateTime=2013-12-29&DisplayableOrderComment=Order&NotificationEmailList.member.1=3yv4at7rtl3blsy%40marketplace.amazon.co.uk&DestinationAddress.Name=Amazon%20Taro&DestinationAddress.Line1=COMPANY%NAME&DestinationAddress.City=GORING&DestinationAddress.StateOrProvinceCode=Oxon&DestinationAddress.PostalCode=RG8%209AQ&DestinationAddress.CountryCode=GB&DestinationAddress.PhoneNumber=01575375219&Items.member.1.DisplayableComment=item&Items.member.1.GiftMessage=gift&Items.member.1.PerUnitDeclaredValue.Value=4.29&Items.member.1.PerUnitDeclaredValue.CurrencyCode=GBP&Items.member.1.Quantity=1&Items.member.1.SellerFulfillmentOrderItemId=CW0298&Items.member.1.SellerSKU=CW0298&Action=CreateFulfillmentOrder&Version=2010-10-01&Timestamp=2017-04-12T14%3A39%3A22.707Z&AWSAccessKeyId=LYIAJ83AORVSI6WLBTQA&SellerId=7RVB74LQNDFDB1&SignatureMethod=HmacSHA256&SignatureVersion=2&Signature=nlB5UTDUXexkurlsc7e%2F4tqLO8vcMRy4X%6Oa0rPIapZN8%3D' 
    }

这可能对您有所帮助。