How to Effectively Utilize Amazon Reviews API for Sellers


As an Amazon seller, having positive reviews about your products is crucial. Gaining insights into your customers’ thoughts is made possible through Amazon’s product review data. But how can you effectively tap into this data? Fortunately, ProgramMatek provides several APIs that can assist you.

Introducing the Amazon Product/Reviews/Keywords API

The Amazon Product/Reviews/Keywords API offers comprehensive information about products listed on Amazon. With this API, you can access product reviews based on their unique ASIN (Amazon Standard Identification Number).

Building a Word Cloud of Review Comments

Interested in visualizing the data? You can create a program using Python that extracts review comments and generates a word cloud. In this article, we’ll provide step-by-step instructions on how to accomplish this for your Amazon products. The insights gained from the word cloud might reveal how your customers perceive your products.

Accessing Amazon Product Reviews

Is there an API for Pulling Amazon Product Reviews?

Absolutely! The Amazon Product/Reviews/Keywords API supports multiple endpoints for querying information about products, including descriptions, prices, reviews, and images.

See also  ProgramMatek: The Best API Integration Platforms for Your Business

Getting Started

To start using the Amazon Product/Reviews/Keywords API, you’ll need to sign up for a free developer account on RapidAPI. RapidAPI is the largest API marketplace, with over 10,000 APIs and a thriving community of developers.

Subscribing to the API

Once you’ve signed in, navigate to the Amazon Product/Reviews/Keywords API Console and click on the “Pricing” tab. Select the basic subscription, which allows for 25 free API requests.

Extracting Product Reviews

After subscribing, access the “Endpoints” tab in the API console. On the left panel, you’ll find a list of supported endpoints. To retrieve product review data, select the “GET Product Reviews” endpoint. The only required parameter is the product’s ASIN, which you can find on any Amazon product page.

Optionally, you can specify the page number and the country-specific Amazon site. Test the endpoint with the default parameter values and wait a few seconds for the API response.

Python Code Snippet for API Invocation

To programmatically call the API using Python, you’ll need the Python Requests library. In the API console, select the Python Requests library to obtain the code snippet for invoking the “GET Product Reviews” endpoint.

With this information, you have everything you need to develop a Python program that generates a word cloud from review comments.

Converting Amazon Product Reviews to a Word Cloud with Python

Now, let’s utilize the Amazon Product/Reviews/Keywords API to create a word cloud from your product reviews.


Before getting started, make sure you have the following dependencies installed:

  • Python 3: Download the latest version from the official Python website and set the system paths accordingly.
  • Matplotlib: This Python plotting library is necessary for rendering the word cloud. Install it using either the provided instructions or the command “pip install matplotlib.”
  • word_cloud: This third-party library allows you to generate word clouds in Python. Install it within your Python 3 environment using the command “pip install wordcloud.”
See also  Snowflake SQL REST API: A Comprehensive Guide

Step 1: Import Statements and Globals

Begin by importing the required libraries and defining a global variable to store your RapidAPI key.

import sys
import json
import requests
import time
from wordcloud import WordCloud, STOPWORDS
import matplotlib.pyplot as plt


Step 2: Triggering the API

Create a function named trigger_api() to trigger the API and retrieve the reviews.

def trigger_api(product_asin, page_no):
    querystring = {"page": str(page_no), "country": "US", "asin": product_asin}
    headers = {
        'x-rapidapi-host': "",
        'x-rapidapi-key': RAPIDAPI_KEY
    url = ""
    response = requests.request("GET", url, headers=headers, params=querystring)
    if response.status_code == 200:
        return json.loads(response.text)
        return None

Step 3: Generating the Word Cloud

Define a function called render_wordcloud() to generate and display the word cloud from an input string containing all the words.

def render_wordcloud(words):
    stopwords = set(STOPWORDS)
    wc = WordCloud(width=800, height=800, background_color='white', stopwords=stopwords, min_font_size=10).generate(words)
    plt.figure(figsize=(8, 8), facecolor=None)

Step 4: Capturing User Input

In the main block, capture the product ASIN as user input.

if __name__ == "__main__":
        comment_words = ''
        input_asin = input("Enter the product ASIN: ")
        print("Getting the latest customer reviews for: " + input_asin)
    except Exception as e:
        print("An error occurred. Aborting.")

Step 5: Extracting Text from Reviews

Implement the logic for extracting review text and generating the word cloud.

for page_no in range(1, 4):
    print("Fetching reviews for page " + str(page_no) + " of 3")
    review_list = trigger_api(input_asin, page_no)
    if review_list is not None:
        for review in review_list["reviews"]:
            review_comment = review["review"]
            review_words = review_comment.split()
            for i in range(len(review_words)):
                review_words[i] = review_words[i].strip(",:;.!?" "'").lower()
            comment_words += " ".join(review_words) + " "
        comment_words = bytes(comment_words, 'utf-8').decode('utf-8', 'ignore')
    print("Generating the word cloud....")

Step 6: Testing the Program

To test the program, search for a product on Amazon and locate its ASIN. Then, run the Python program and enter the ASIN when prompted. The program will fetch the reviews and display a word cloud based on the provided input.

See also  API Penetration Testing: Uncovering Security Vulnerabilities in APIs


By utilizing the Amazon Product/Reviews/Keywords API and Python, you can create a word cloud that visualizes your product’s review comments. This allows you to gain valuable insights into how customers perceive your products. With the additional spark of filtering common words and displaying customer ratings, you can transform the word cloud into a practical product review analytics tool.

If you have any comments or queries about this Python program, feel free to reach out. ProgramMatek is here to help you succeed.

Connect to the Amazon Product/Reviews/Keywords API now!