Best Programming Practices
The following best practices describe how you can increase the effectiveness of your Product Advertising API 5.0 applications.
Read the Product Advertising API Terms and Conditions
The Product Advertising API Terms and Conditions spell out in detail the limitations that Amazon enforces on all Product Advertising API applications. All Product Advertising API applications should direct sales to Amazon and thus earn Associate fees. Application that do not have this purpose or do not meet other Product Advertising API Terms and Conditions will be blocked from accessing Product Advertising API.
Use our SDK
Our SDK will help you integrate with Product Advertising API quickly. It takes away all the heavy lifting from you including signing the request, request serialization and response de-serialization. It provides flexibility through allowing you to choose from different access methods based on your needs and preferences. Refer using sdk section for more details.
Use your credentials (Access Key, Secret Key) and Partner tag correctly in Product Advertising API requests
You must use correct credentials when using Product Advertising API. Incorrect information will lead to errors and/or loss of associate fees.
To become a Product Advertising API developer, you must provide your credentials. For more details, refer to Register for Product Advertising API. Your credentials are a combination of Access Key and Secret Key. Every Product Advertising API request you submit must include the Access Key. The Secret Key is used for signing the request and used for authenticating the requester.
To earn advertising fees, you must register with Amazon as an associate. For more details, refer to Sign up as an Amazon Associate. In return, you receive a Partner tag, which uniquely identifies your Associate store. A Partner tag is provided in each Product Advertising API request and is added to all vended links. When customers uses these links to visit Amazon and make qualifying purchases you'll receive Associate fees. Alterations of any kind to vended links will lead to missing attribution and loss of Associate fees. Amazon also uses your Associate tag to monitor your use of and adjust your access to Product Advertising API.
Understand available operations, parameters and their usage
Product Advertising API provides multiple operations to facilitate product discovery. Common and operation specific parameters allows you to provide inputs on expected response. Using the right operations and parameters can dramatically enhance your customer’s shopping experience and increase your Associate commissions.
Use the right Resource
Product Advertising API allows you to ask for specific information, reducing response time, payload size and processing time on your side. A Resource is a granular collection of data returned by Product Advertising API. Product Advertising API, when provided with list of Resources, will only return the information you seek. We recommend that you specify only the necessary Resources that return the information your application needs, which will optimize latency and improve your application response time.
Use multiple ASINs and BrowseNodes in requests
Use multiple ASINs in GetItems and multiple BrowseNodeIds in GetBrowseNodes operation requests to reduce the number of requests made to Product Advertising API. This will help you increase throughput from API and optimally use the request limits allocated to you.
Example: You can request information of up to 10 ASINs in a single request with GetItems operation, instead of making 10 individual requests with 1 ASIN. Please refer to GetItems Operation Guide and operations documentation for more details.
Use caches carefully
Cache plays a critical role in keeping call to Product Advertising API under control and lead to faster response time for your application. Product Advertising API responses can be cached on your end under the guidelines defined in the License Agreement. It is against the Product Advertising API Terms and Conditions to cache customer information derived from Amazon.
How to cache
Any caching mechanism of your preference can be used, which allows you to cache Fields/Nodes/Resources in Product Advertising API response. Using cache would require defining time (Time To Live/TTL) for which these values are to be cached, they depend on Fields/Nodes/Resources as some of them are more volatile as compared to others.
Please refer following table to configure cache times for mentioned Fields/Nodes/Resources and their children.
|Fields/Nodes/Resources||Cache time (TTL)|
|All other Fields/Nodes/Resources (example: BrowseNodes, DetailPageURL, Images, ItemInfo)||1 day|
How to use cache
When your application receives a request, before making a Product Advertising API call first check if all required resources are present in cache. If yes, serve request for your application using the cached information. If not, make the request to Product Advertising API and use the response to serve your application request. Add response values for each of the requested Resources to cache with mentioned in the above cache time outs. For your next request, again check cache if some of resources required are present in cache. If some are and some are not make the request to Product Advertising API for only the Resources missing in the cache. This will improve your application response time significantly.
Handling web crawler traffic
Web crawlers can eat into your request rates. You can address them by using measures like robot.txt.