亚马逊 MWS API 中的请求限制问题
我正在测试 C# 中的 Amazon MWS API,用于提交提要,但是在设置 AWS 密钥、访问密钥等之后。在代码中,我收到 RequestThrottled 错误,因此详细说明了该错误是什么,但找不到任何代码示例如何解决该问题。
我想将 feed.xml 上传到亚马逊卖家账户,
<?xml version="1.0" encoding="iso-8859-1"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>1.01</DocumentVersion>
<MerchantIdentifier>M_EXAMPLE_123456</MerchantIdentifier>
</Header>
<MessageType>Product</MessageType>
<PurgeAndReplace>true</PurgeAndReplace>
<Message>
<MessageID>1</MessageID>
<OperationType>Insert</OperationType>
<Product>
<SKU>56789</SKU>
<StandardProductID>
<Type>ASIN</Type>
<Value>B0EXAMPLEG</Value>
</StandardProductID>
<ProductTaxCode>A_GEN_NOTAX</ProductTaxCode>
<DescriptionData>
<Title>Example Product Title</Title>
<Brand>Example Product Brand</Brand>
<Description>This is an example product description.</Description>
<BulletPoint>Example Bullet Point 1</BulletPoint>
<BulletPoint>Example Bullet Point 2</BulletPoint>
<MSRP currency="USD">25.19</MSRP>
<Manufacturer>Example Product Manufacturer</Manufacturer>
<ItemType>example-item-type</ItemType>
</DescriptionData>
<ProductData>
<Health>
<ProductType>
<HealthMisc>
<Ingredients>Example Ingredients</Ingredients>
<Directions>Example Directions</Directions>
</HealthMisc>
</ProductType>
</Health>
</ProductData>
</Product>
</Message>
</AmazonEnvelope>
但出现如下错误,
Caught Exception: Request from SubmitFeed:AKIAJI4PSK4HXY6UCNMA;A2DNAGZJ1EWQLW is
throttled.
Response Status Code: ServiceUnavailable
Error Code: RequestThrottled
Error Type: Sender
Request ID: fc59c802-04da-4dd3-89a8-db5f525cac39
XML: <ErrorResponse xmlns="http://mws.amazonaws.com/doc/2009-01-01/"><Error><Typ
e>Sender</Type><Code>RequestThrottled</Code><Message>Request from SubmitFeed:AKI
AJI4PSK4HXY6UCNMA;A2DNAGZJ1EWQLW is throttled.</Message><Detail>System.Object</D
etail></Error><RequestId>fc59c802-04da-4dd3-89a8-db5f525cac39</RequestId></Error
Response>
如何解决?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据亚马逊的API 参考
SubmitFeed
操作的最大请求配额为 15,恢复率为每 2 分钟请求一次。这意味着您可以突发 15 次调用此操作,但在此之后您将受到限制 2 分钟,直到 Amazon 允许您发出另一个请求。您可以在他们的 开发人员指南,其中更好地描述了他们如何使用
漏桶算法
。您的 Feed 可能没有任何问题,但由于您发出了太多请求(可能超过 15 个),您受到了限制。我的建议是以这样的方式构建代码,即考虑亚马逊限制,并在受到限制时采用退避算法(例如在“恢复率”期后返回,具体取决于您的呼叫类型)正在做)。另外,请记住,MWS 的另一个限制是所有类型的调用每小时只能处理 10000 个请求。
As per Amazon's API reference the
SubmitFeed
operation has a maximum request quota of 15 and a restore rate of a request every 2 minutes. This means that you're allowed to make calls to this operation in burst of 15, but after this you're throttled for 2 minutes, until Amazon allows you to make another request.You can find this better explained in their developer guide where they describe better how they make use of the
leaky bucket algorithm
.Probably there isn't anything wrong with your feed, but because you made too many requests (probably more than 15) you got throttled. My advice is to build your code in such a way that you take into consideration Amazon throttlening and have a back-off algorithm when you're being throttled (like come back after a "restore rate" period, specific to the type of call you're doing). Also, keep in mind that another limitation MWS has is of 10000 requests per hour across all type of calls.