我正在测试 Amazon MWS API in C# for submit feeds 的 API 示例,但是在代码中设置 AWS secret key 、访问 key 等之后,我收到 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>
谁能给我解决这个问题的解决方案?
谢谢!
最佳答案
根据 Amazon's API reference SubmitFeed
操作的最大请求配额为 15,并且每 2 分钟恢复一次请求。这意味着您可以在 15 次突发中调用此操作,但在此之后您将被限制 2 分钟,直到 Amazon 允许您发出另一个请求。
您可以在他们的 developer guide 中找到更好的解释。他们更好地描述了如何使用 leaky bucket algorithm
.
您的提要可能没有任何问题,但是因为您提出了太多请求(可能超过 15 个),所以您受到了限制。我的建议是以这样一种方式构建您的代码,即您考虑到 Amazon 节流,并在您被节流时使用回退算法(例如在“恢复率”期后回来,特定于您的调用类型正在做)。此外,请记住,MWS 的另一个限制是所有类型的调用每小时 10000 个请求。
关于amazon - 亚马逊 MWS API 中的请求限制问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7584507/