Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RequestThrottling issue in Amazon MWS API

I am testing API Sample of Amazon MWS API in C# for submit feeds however after setting AWS Secret key , access key etc. in code i am getting error of RequestThrottled , so there is details what is that but could not find any code sample how to resolved that.

I would like to upload feed.xml to amazon seller account

  <?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>

Error getting as per below

 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>

Can anyone give me solution to resolve this?

Thanks!

like image 507
Arun Rana Avatar asked Sep 28 '11 14:09

Arun Rana


People also ask

How do you handle a throttling API?

Best practices to handle throttling The following are best practices for handling throttling: Reduce the degree of parallelism. Reduce the frequency of calls. Avoid immediate retries because all requests accrue against your usage limits.

What is API request throttling?

What is API Throttling? API throttling allows you to control the way an API is used. Throttling allows you to set permissions as to whether certain API calls are valid or not. Throttles indicate a temporary state, and are used to control the data that clients can access through an API.

What is API throttling in AWS?

AWS throttling limits are applied across all accounts and clients in a region. These limit settings exist to prevent your API—and your account—from being overwhelmed by too many requests. These limits are set by AWS and can't be changed by a customer.


1 Answers

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.

like image 98
hyperboreean Avatar answered Sep 22 '22 08:09

hyperboreean