You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

如何通过AWS API及AWS Advertising Product API5从关键词获取ASIN/产品信息

Answers to Your AWS Product Data API Questions

Alright, let's break down your two questions step by step—both involve Amazon's APIs (often referenced under AWS umbrella terms) for pulling product data via keywords, but they're distinct services, so we'll cover each one clearly.

1. Fetching Products/ASINs via Amazon Product Advertising API (Associates API)

First, note that this is the API for Amazon Associates (affiliates) to get product data. It's not a core AWS service, but it's commonly grouped with AWS-related Amazon APIs.

Step 1: Prerequisites

  • You need an Amazon Associates account (sign up if you don't have one)
  • Generate your Access Key ID, Secret Access Key, and Associate Tag from your Associates dashboard
  • Ensure you have permission to use the SearchItems operation (enabled by default for most accounts)

Step 2: Use the SearchItems Operation

This is the primary endpoint to search for products by keywords. You'll need to sign your requests (Amazon uses AWS Signature Version 4 for authentication).

Example (Python with bottlenose library)

bottlenose handles the signature process automatically, which saves you a ton of work:

import bottlenose
from xml.etree import ElementTree

# Initialize the API client
amazon = bottlenose.Amazon(
    AWS_ACCESS_KEY_ID="YOUR_ACCESS_KEY",
    AWS_SECRET_ACCESS_KEY="YOUR_SECRET_KEY",
    AWS_ASSOCIATE_TAG="YOUR_ASSOCIATE_TAG",
    Region="us-east-1"  # Adjust based on your target marketplace (e.g., "eu-west-1" for UK)
)

# Search for products using a keyword
response = amazon.SearchItems(
    Keywords="wireless headphones",
    SearchIndex="Electronics",  # Optional but narrows results
    ResponseGroup="ItemAttributes,Images"  # Specify what data you want back
)

# Parse the XML response to get ASINs and product info
root = ElementTree.fromstring(response)
for item in root.findall(".//Item"):
    asin = item.find("ASIN").text
    title = item.find(".//Title").text
    print(f"ASIN: {asin} | Title: {title}")

Key Notes

  • Replace the placeholder values with your actual credentials
  • Adjust Region and SearchIndex to match your target Amazon marketplace
  • The ResponseGroup parameter lets you specify which product fields to retrieve (e.g., ItemAttributes for basic details, Offers for pricing)

2. Fetching Detailed Product Info/ASINs via AWS Advertising Product API v5

This API is part of Amazon's Advertising Platform, designed for advertisers to access product data for campaign optimization. It requires an Amazon Advertising account.

Step 1: Prerequisites

  • An Amazon Advertising account linked to your seller/advertiser profile
  • Generate an OAuth 2.0 Access Token (you'll need to go through the authorization flow, or use Amazon's Advertising API SDKs to handle this)
  • Ensure your account has access to the Product API v5

Step 2: Use the SearchProducts Endpoint

This endpoint lets you search for products by keywords and returns detailed data including ASINs, pricing, category info, and more.

Example (Python with requests library)

First, get your Access Token (Amazon's docs cover the OAuth flow in detail). Then make the request:

import requests

# Your Advertising API credentials and endpoint
ACCESS_TOKEN = "YOUR_OAUTH_ACCESS_TOKEN"
MARKETPLACE_ID = "ATVPDKIKX0DER"  # US marketplace; adjust for others
ENDPOINT = f"https://advertising-api.amazon.com/v5/products/search?marketplaceIds={MARKETPLACE_ID}"

# Request headers
headers = {
    "Authorization": f"Bearer {ACCESS_TOKEN}",
    "Content-Type": "application/json"
}

# Search payload with keyword and filters
payload = {
    "keywords": ["wireless noise cancelling headphones"],
    "maxResults": 10,  # Number of results to return
    "filters": {
        "price": {
            "greaterThan": 50  # Optional filter to narrow results
        }
    }
}

# Make the POST request
response = requests.post(ENDPOINT, json=payload, headers=headers)
response_data = response.json()

# Extract ASINs and product details
for product in response_data["products"]:
    asin = product["asin"]
    title = product["title"]
    price = product["offers"][0]["price"]["amount"]
    print(f"ASIN: {asin} | Title: {title} | Price: ${price}")

Key Notes

  • The marketplaceIds parameter is required (find your marketplace's ID in Amazon's Advertising API docs)
  • The payload supports additional filters like brand, category, or price range to refine results
  • The response includes detailed product metadata useful for advertising campaigns, like competitive pricing and category hierarchy

内容的提问来源于stack exchange,提问作者React Engineer

火山引擎 最新活动