E-commerce has currently become a major player in the internet landscape. With more and more retailers offering all kinds of products and services online, consumers can order almost anything with just a few clicks from their mobile or PC.
Amazon.com is one of the leading online retailers that provides thousands of products and services globally. In this article, we will see how to query Amazon to retrieve product information using the Amazon Product API in different programming languages.
What is Amazon Product/Reviews/Keywords API?
This API provides users with the ability to collect basic information about products on Amazon. It enables users to search for products using keywords and extract additional product information and product reviews using the Amazon Standard Identification Number (ASIN).
Moreover, this API enables filtering search results for targeted product identification. Some of the available filters are; Marketplace country which consists of 16 countries where Amazon is directly available, review rating (star count), product variant, etc. These filters help to create a powerful and single API that facilitates Amazon product search functionality.
How does the Amazon Product/Reviews/Keywords API work?
This API will send a request to the specific endpoint, including all the required parameters (keyword, ASIN, marketplace) and authentication details (API Keys). It will then receive a response payload in JSON format with the result of the request. A successful request will provide the garner of the required information in the response payload, while an unsuccessful request will generate an error.
Following is an example response for a Product Search API query with the keyword “iphone” and the Marketplace country limited to the US.
{ "amazonChoice":false "amazonPrime":false "asin":"B07KFMTWVF" "bestSeller":false "price":{6 items "before_price":0 "currency":"USD" "current_price":"597.29" "discounted":false "savings_amount":0 "savings_percent":0 } "reviews":{2 items "rating":4.4 "total_reviews":2755 } "score":"12122.00" "sponsored":false "thumbnail":"https://m.media-amazon.com/images/I/71isxv6Wd-L._AC_UY218_.jpg" "title":"Apple iPhone XS Max, 64GB, Gold - Fully Unlocked (Renewed)" "url":"https://www.amazon.com/dp/B07KFMTWVF" }
Target Audience for Amazon Product/Reviews/Keywords API
Product Developers/Designers
Product developers or designers can identify the market trends of the products using this API. It is important to recognize which products are popular among consumers, which are highly regarded, and what are the common complaints on the targeted products. Depending on this information, product teams can create new products or modify existing products to address common complaints.
Market Researchers
Market researchers can use this API to gain the market sentiment for a particular product or a product category. With the API’s ability to differentiate various geographical markets, researchers can granulate data to identify exact trends in each amazon marketplace. This enables us to gain a broader understanding of the market for each product or category. Using this information, researchers can predict future market trends, consumer behavior, product and consumer preferences, etc.
Organizations
Product data is an integral part of any organization that helps to develop consumer or business-focused products. By obtaining user reviews and product information of one of the largest online retailers, organizations can use those data for various purposes such as product design, marketing, and customer support. For a simple example, if a product is highly reviewed, the organization can increase the production of that particular product or if the market penetration of a product is relatively low, the marketing and sales teams can direct their efforts more towards that product. Essentially, this API will help organizations grow and achieve their business goals.
Simply said, this API is a gold mine for any individual or business with the need to gain access to product information from one of the largest online retailers in the world.
How to connect to the Amazon Product Reviews Keyword API Tutorial – Step by Step
Step 1 – Sign up and Get a RapidAPI Account.
RapidAPI is an API marketplace where you can find thousands of readily available APIs with code samples for each endpoint in multiple programming languages. It helps to cut down the learning curve of new APIs and provides the ability to easily integrate the functionality in your program.
We can sign up for a RapidAPI account using their website rapidapi.com. The RapidAPI account can be created with a Single Sign-On option using our existing Google, GitHub, or Facebook accounts or we can simply create a brand new RapidAPI account.
Step 2 – Search the API Marketplace
Navigate to the API Marketplace and search for “Amazon API” there. Then, select the desired API from the search results. In this instance, we will select the Amazon Product/Reviews/Keywords API.
Step 3 – Subscribe to the API
We need to subscribe to the API before we can use it. For that, navigate to the Pricing section of the Amazon Product/Reviews/Keywords API and subscribe to your preferred plan. The plan you select will depend on your specific requirements.
Step 4 – Test the API
The next step is to test our API. Navigate to the endpoints section which describes all the available endpoints for the API with code snippets in multiple programming languages. Those code snippets can be used to integrate the API with any application.
Simply select the endpoint you want to test and add the required parameters (request payload parameters). Then click on the “Test Endpoint” button.
Amazon Product/Reviews/Keywords API Endpoint
This API provides four endpoints, each with a specifically targeted functionality. The following table describes all those endpoints with their usage and the required parameters. This API utilizes the X-RapidAPI-Key
and X-RapidAPI-Host
as the header parameters for authentication.
Endpoint | Usage | Parameters – Required | Parameters – Optional |
Product Reviews (All Countries) | This endpoint returns product reviews for the specified product. (Using ASIN) | Amazon Standard Identification Number (ASIN) | Page Number (page), Country (country), Star Rating (filter_by_star), Product Variant (variant), Top Reviews (top) |
Product Details (All Countries) | This endpoint returns product details for the specified product. (Using ASIN) | Amazon Standard Identification Number (ASIN) | Country (country) |
Product Search (All Countries) | This endpoint returns products that match a specified keyword. | Keyword | Page Number (page), Country (country), Product Category (category) |
Get list of categories | Get a list of valid product categories by country. | Country (country) |
Integrating Amazon Product/Reviews/Keywords API to an Application
In this section, we will see how to integrate this API into a software application using Python, PHP, Ruby, and Javascript. Before trying these code snippets, make sure that you have configured the appropriate environments and required libraries.
We will be using the Product Details endpoint for all the following code snippets. Each request will use the RapidAPI API key for authentication, and we have indicated it using <<API KEY>>
. The Amazon Standard Identification Number of the targeted product is indicated using <<ASIN>>
. The parameters that are used in the requests will depend on the endpoint and the requirements.
Python Code Snippet (requests)
import requests url = "https://amazon-product-reviews-keywords.p.rapidapi.com/product/details" querystring = {"asin":"<<ASIN>>","country":"US"} headers = { 'x-rapidapi-key': "<<API KEY>>", 'x-rapidapi-host': "amazon-product-reviews-keywords.p.rapidapi.com" } response = requests.request("GET", url, headers=headers, params=querystring) print(response.text)
PHP Code Snippet (HTTP v2)
<?php $client = new http\Client; $request = new http\Client\Request; $request->setRequestUrl('https://amazon-product-reviews-keywords.p.rapidapi.com/product/details'); $request->setRequestMethod('GET'); $request->setQuery(new http\QueryString([ 'asin' => '<<ASIN>>', 'country' => 'US' ])); $request->setHeaders([ 'x-rapidapi-key' => '<<API KEY>>', 'x-rapidapi-host' => 'amazon-product-reviews-keywords.p.rapidapi.com' ]); $client->enqueue($request)->send(); $response = $client->getResponse(); echo $response->getBody();
Ruby (net::http)
require 'uri' require 'net/http' require 'openssl' url = URI("https://amazon-product-reviews-keywords.p.rapidapi.com/product/details?asin=<<ASIN>>&country=US") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Get.new(url) request["x-rapidapi-key"] = '<<API KEY>>' request["x-rapidapi-host"] = 'amazon-product-reviews-keywords.p.rapidapi.com' response = http.request(request) puts response.read_body
Javascript (Axios)
import axios from "axios"; const options = { method: 'GET', url: 'https://amazon-product-reviews-keywords.p.rapidapi.com/product/details', params: {asin: '<<ASIN>>', country: 'US'}, headers: { 'x-rapidapi-key': '<<API KEY>>', 'x-rapidapi-host': 'amazon-product-reviews-keywords.p.rapidapi.com' } }; axios.request(options).then(function (response) { console.log(response.data); }).catch(function (error) { console.error(error); });
Benefits of the Amazon Product/Reviews/Keywords API
Customization and Flexibility
The main advantage of this API is its customizability and flexibility in searching and identifying products. With its ability to search for products by keywords and categories, users can narrow down the search criteria to get the exact product from Amazon and obtain the Amazon Standard Identification Number (ASIN) of that product. Then, users can obtain additional product details and user reviews using that ASIN. All these integrated with the additional filters (parameters) make this Amazon API a highly customizable and flexible API.
Speed
Despite the vast amount of data available on the Amazon platform, this API generates speedy responses for the API requests with a 97% service level and an average 5 second response time. This is an important factor when integrating the API in software applications as API response delays can negatively impact the overall performance of the application and lead to negative customer experiences. These are non-issues with a responsive API like this, and the API will have a relatively low impact on the application performance.
Ease of Use
This API provides an easy and straightforward base for any developer to get started with clearly defined endpoints and parameters. Additionally, users can easily integrate this API functionality into an application using the provided code snippets in multiple programming languages. With its example responses, users can validate their API responses by knowing what to expect and easily debug their code to obtain the necessary details. Amazon Product/Reviews/Keywords API is an all-in-one solution for obtaining product information with all of these under a single API.
Alternative to Amazon Product/Reviews/Keywords API
Following are some alternative APIs that can be used to query Amazon to obtain product information.
Amazon Price – An API primarily focused on getting real-time price information of Amazon products using ASIN. This API can also be used as a replacement for Amazon Affiliate API.
Amazon Products – This API can be used to search product information as well as get available daily offers from Amazon.
Amazon-Price – This simple API provides users with access to real-time amazon product information such as prices, ratings, and the number of reviews. Additionally, this API can detect the prime status and get available offers for a specific product.
Amazon Product Price Data – A lightweight and simple API to obtain the current price, prime status, image URL, and product title for a specific product using ASIN.
Amazon Data – One of the fastest and cheapest APIs available to get real-time data from Amazon. This API can search for products using the ASIN code or keywords. Furthermore, it can retrieve information about product reviews, ratings, and comments as well as get deals and offers on Amazon.
Amazon Price History – This API can be utilized to obtain historical price information of a specific product for up to 1 year.
Summary
Amazon Product/Reviews/Keywords API is a complete solution for querying the Amazon e-commerce platform and obtaining product and review information. In this article, we have covered the basic structure of this API, its target audience, advantages, and sample code snippets to dive into the functionality of this API quickly.
Leave a Reply