If you sell products via Amazon and are interested in using data to improve your business, then look no further than Amazon Marketplace Web Service (MWS). Amazon MWS provides robust functionality for generating a wide variety of reports that will help you make decisions (among other features like inventory and order management). In this article, we’re going to walk through how to start using MWS and the basic functionality for accessing reporting.
Before we start, we want to mention that programmatically using this service is something that can be done quite easily, as Amazon provides an open source client library for interacting with their MWS. The library is available in several different development languages, including C#, PHP, and Java, and is ready to be used as is. During a recent project, we found it cleaner to take the library (the C# version) and compile it into a DLL (Dynamic Link Library) so it could be included in future projects.
Accessing the Amazon Marketplace Web Service
To use the Amazon Marketplace Web Service, sellers go through a registration process that generates certain “tokens” that are required for access. Specifically, a seller will need an Access Key ID, a Secret Access Key, and their Amazon Merchant ID in order to communicate with the MWS. The client library (thankfully) handles the building of properly formatted requests, so the tokens need only be passed to the various classes upon their instantiation or setup.
Downloading the Reports
Once you access the MWS, a wide variety of report types are available by on-demand generation or scheduling (see list of available Report Types). Many API’s are available for managing the reports, but the process of requesting a report and then retrieving it from the service can be simplified down to three particular API calls (see requesting a Report Flowchart):
The RequestReport call initiates a request for a specific ReportType (depending on the report, you may have the option to pull a subset of the data with filters like StartDate, EndDate, MarketPlaceID, and more). A successful call of RequestReport will generate a response that contains a ReportRequestId. Take note of this ID, as it will be used to check the status of the report and you will ultimately download it when it is ready.
Once you have your ReportRequestID, the fetching of the requested report is a two-step process. A call is made to the API GetReportRequestList. This API will ask for your report ID (or ID’s – if you are requesting multiple reports) to check on the status.
If the report is ready to be downloaded, its status response will be “_DONE_”, and the response will contain a GeneratedReportId. Enter this GeneratedReportId into the API GetReport to initiate the download of your report file.
Most reports are formatted as either tab-delimited text files or XML, both of which can be easily processed and imported into a database for detailed analysis.
Amazon also provides a useful resource for debugging MWS API calls (see MWS Scratchpad). This site is useful for verifying that your user credentials (access key ID, secret key ID, etc.) are properly registered and working before trying to use your custom applications, as well as for troubleshooting other types of errors.
We hope that this breakdown of using Amazon’s Marketplace Web Service (MWS) was informative and useful. If your business needs help automating and integrating MWS into your current analytics processes, don’t hesitate to contact us!
Keep your data analytics sharp by subscribing to our mailing list!
Thanks for reading! Keep your knowledge sharp by subscribing to our mailing list to receive fresh Key2 content around data analytics, business intelligence, data warehousing, and more!
Key2 Consulting is a data warehousing and business intelligence company located in Atlanta, Georgia. We create and deliver custom data warehouse solutions, business intelligence solutions, and custom applications.