Amazon Services
Amazon Marketplace Web Service (Amazon MWS) Documentation
Amazon MWS Documentation

Using the Amazon MWS client libraries

Each Amazon MWS API section has its own client library that contains code for doing many common tasks when working with Amazon MWS. By using an Amazon MWS client library, you save time and you know the request you send is correctly formatted. For example, the Amazon MWS client libraries perform the following tasks for you:

  • Request Signature - creates a valid request HMAC-SHA signature. Each request must have a valid signature or the request is rejected. A request signature is calculated using your Secret Access Key, which is a shared secret, given to you when you registered, and known only to you and Amazon MWS.
  • Timestamp - adds a timestamp on each request you submit. Each request must contain the timestamp of the request.
  • Requests - builds a valid request for you based on the operation you select and the parameters you enter.
  • User-Agent header - creates the User-Agent header.
  • Stream - creates a stream you use to receive downloaded reports when using the GetReport operation.

If you create your own client library

You can create your own client library for use with Amazon MWS. Your code should construct and sign a request in the format expected by Amazon MWS, and then you parse the resulting XML response.

You access Amazon MWS by following these steps:

  1. Determine the correct Amazon MWS endpoint to use.

    Amazon MWS endpoints vary by region for the marketplace you are trying to access. Consult Amazon MWS endpoints and MarketplaceId values for the correct endpoint to use for your intended marketplace.

  2. Determine the throttling limits for the operation you want to submit.

    Every Amazon MWS API has limits to how often it can be invoked over certain time periods. If you exceed these limits, your call will fail and you will have to wait for your next call. This waiting period will be based on the refresh rate for the API. For more information, see Throttling: Limits to how often you can submit requests.

    For each individual API, see the Throttling section on the API reference page for specific throttling limits.

  3. Familiarize yourself with the MWS request format.

    Amazon MWS supports query requests for calling web service actions. Query requests are simple HTTP requests, using the GET or POST method with query parameters in the URL or HTTP body, respectively. Amazon MWS requires the use of HTTPS in order to prevent third-party eavesdropping on your communication with Amazon.

    Each of the HTTP header lines must be terminated with a carriage return and a line feed. Query requests must contain an Action parameter to indicate the action to be performed. The response is an XML document.

  4. Set the timestamp for your request.

    See Working with Timestamps.

  5. Construct a query string for the request.

    See Creating a Canonicalized Query String.

  6. Sign the query string and create the request.

    See Signing a Query Request.

  7. Set the User-Agent Header for your application.

    See Creating your User-Agent Header.

  8. Send the correctly formatted URL request and an HTTP header containing the User-Agent header to the endpoint for your Amazon marketplace.

    The URL contains the following parts:

    The following is an example of a complete request URL that you could submit. The actual request should not contain white space or line breaks.

    https://mws.amazonservices.com/AWSAccessKeyId=AKIAFJPPO5KLY6G4XO7Q&Action=G
    etFeedSubmissionResult&FeedSubmissionId=4321011681&MWSAuthToken=amzn.mws.4e
    a38b7b-f563-7709-4bae-87aeaEXAMPLE&Marketplace=ATVPDKIKX0DER&SellerId=A3F1L
    GRLCQDI4D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2011-02-0
    4T23%3A08%3A19Z&Version=2009-01-0&Signature=WhateverTheSignatureWas1HTTP/1.
    1Host:mws.amazonservices.comX-Amazon-User-Agent:AmazonJavascriptApp/1.0(Lan
    guage=Javascript)Content-Type:text/xml
  9. Parse the response.