This section provides step-by-step instructions that you need to complete before you can submit your first Product Advertising API request.
Getting Set Up with Product Advertising API
Associates earn commissions by using their own website to refer sales to www.amazon.com. To get a commission, an Associate must have an Associate ID. This ID works only in the locale in which you register. If you want to be an Associate in more than one locale, you must register in all relevant locales.
Sign up to become an Associate at http://associates.amazon.com/exec/panama/associates/apply.
For more information about becoming an Associate, refer to one of the following websites, depending on your locale.
When you register as an Amazon Associate, an Associate tag is sent to you by return email. An Associate tag, also known as an Associate ID, is an automatically generated unique identifier that you will need to make requests through the Product Advertising API. When you log in to the Amazon Associates website for your locale, the page that you are directed to includes a message that says "Signed in as" followed by your Associate tag.
You need security credentials to call the Product Advertising API, authenticate requests, and identify yourself as the sender of a request. Two types of credentials are available:
AWS security credentials (access key ID and secret access key)
IAM roles are not currently supported. You must use the root account credentials or certificates.
To generate and manage your credentials, go to the AWS Security Credentials Console.
Product Advertising API requests can be integrated into applications using most modern programming languages. In the following table, click the tool you would like to use to implement Product Advertising API. The link takes you to the corresponding website where you can download and install the appropriate toolkit.
|Language||API Style||Tools Used|
REST (using HTTP POST)
To download the modules used in the following Perl example, go to CPAN website:
REST (using HTTP GET)
The PHP example uses the base installation of PHP5.
Because PHP configurations vary, we're using a command-line interface to run our example. You are also welcome to run the example through a web server, but those details are not covered in this guide.
All requests you send to Product Advertising API must be authenticated using a signed version of the request. We have a tool, the Product Advertising API Signed Requests Helper, to generate this signed request. You can use this tool online or download it to your machine.
This section helps you confirm that your development environment is set up correctly. Skip to the section that corresponds to the toolkit you downloaded. Or, if you are viewing this document online, you can view the setup steps for your preferred programming language by using the Filter View list on the top-right corner of the page.
You can implement Product Advertising API operations directly in Java. You can also generate and use the Product Advertising API Java Client Side library to simplify your Java implementations. This section explains how to generate the Product Advertising API Java Client-Side Library. The next section shows you how to use it to create a request.
You use the wsimport utility in Java 6 to generate the stubs from the Product Advertising API WSDL, which is located at http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl.
To generate the Product Advertising API client-side library stubs
Go to the directory where you want to generate the stubs and create a "build" directory and a "src" directory.
All of the generated source code goes under "src" folder.
If you are using Eclipse 3.2, create a custom binding to disable "Wrapper Style" code generation.
<jaxws:bindings wsdlLocation="http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl" xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"> <jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle> </jaxws:bindings>
This step is necessary because Eclipse 3.2 does not support wrapper style generated code. However, if your IDE does support wrapper-style generated code, such as NetBeans, this step is not required.
Run the command:
wsimport -d ./build -s ./src -p com.ECS.client.jax http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl -b jaxws-custom.xml .
You can find the generated stubs in the path, com.ECS.client.jax.
Several file types are generated in the package, com.ECS.client.jax:
AWSECommerceService—This file identifies the Product Advertising API service.
AWSECommerceServicePortType—This file provides the port type that the client can listen on.
This file also contains a list of all Product Advertising API operation signatures that can be used to build the client.
Product Advertising API requires that you have successfully installed Microsoft Visual Studio.
To confirm the installation
Open Visual Studio 2005 C# Express Edition.
Click Help > About Microsoft Visual Studio.
A dialog box opens. It should list Microsoft Visual Studio 2005 and version 2.0 of the .NET Framework.
In your application, you need to add a web reference to the Product Advertising API WSDL you want to use.
To add a web reference
On the Project menu, click Add Web Reference.
In the URL box, type http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl, and then click Go.
Click Add Reference.
A new Web References folder is added to the Solution Explorer.
You can now reference the SOAP proxy using your project namespaces. For example:
Run the following commands to verify that you have installed all of the necessary Perl modules:
perl -MDigest::HMAC_SHA1 -e 1 perl -MMIME::Base64 -e 1 perl -MLWP -e 1 perl -MXML::XPath -e 1 perl -MDate::Format -e 1
You should not receive any error messages.
To verify your PHP installation
Use a command-line interface to run the following command:
This command assumes you are either in your PHP installation directory or it is in your PATH system variable.
The response should be similar to the following:
PHP 5.1.2 (cli) (built: Jan 11 2006 16:40:00) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies