Amazon Product Page API: Async Structured Data in Ruby
Scrape Amazon product pages into clean JSON/CSV with ScraperAPI async structured endpoint in Ruby. Extract prices, reviews, variants, and metadata by ASIN.
This endpoint will retrieve product data from an Amazon product page and transform it into usable JSON.
Single ASIN request:
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://async.scraperapi.com/structured/amazon/product')
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = {
apiKey: 'APIKEY',
asin: 'ASIN',
country_code: 'COUNTRY_CODE',
tld: 'TLD',
callback: {
type: 'webhook',
url: 'CALLBACK'
}
}.to_json
begin
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
puts response.body
rescue => e
puts "Error: #{e.message}"
end
Multiple ASIN request:
require 'net/http'
require 'json'
require 'uri'
uri = URI('https://async.scraperapi.com/structured/amazon/product')
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = {
apiKey: 'APIKEY',
asin: ['ASIN1','ASIN2','ASIN3'],
country_code: 'COUNTRY_CODE',
tld: 'TLD',
callback: {
type: 'webhook',
url: 'CALLBACK'
}
}.to_json
begin
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
puts response.body
rescue => e
puts "Error: #{e.message}"
end
Parameters available for this method:
ApiKey
User account’s normal API key.
ASIN/ASINS
Amazon product ASIN(s).
TLD
Valid values include:
com (amazon.com)
co.uk (amazon.co.uk)
ca (amazon.ca)
de (amazon.de)
es (amazon.es)
fr (amazon.fr)
it (amazon.it)
jp (amazon.co.jp)
in (amazon.in)
cn (amazon.cn)
sg (amazon.com.sg)
mx (amazon.com.mx)
ae (amazon.ae)
br (amazon.com.br)
nl (amazon.nl)
au (amazon.com.au)
tr (amazon.com.tr)
sa (amazon.sa)
se (amazon.se)
pl (amazon.pl)
COUNTRY
Valid values are two letter country codes for which we offer Geo Targeting (e.g. “au”, “es”, “it”, etc.).
Where an amazon domain needs to be scraped from another country (e.g. scraping amazon.com from Canada to get Canadian shipping information), both TLD and COUNTRY parameters must be specified.
Sample Response
Single ASIN Request:
{
"id": "f9c41146-ecd3-415c-ae0a-461de670e2e8",
"status": "running",
"statusUrl": "http://async.scraperapi.com/structured/amazon/product/f9c41146-ecd3-415c-ae0a-461de670e2e8",
"asin": "B079BLHH67"
"tld": ".com"
}
Multiple ASIN Request:
[
{
"id": "5b0c838a-d0eb-46c3-ad9a-e82e398d56a5",
"status": "running",
"statusUrl": "http://async.scraperapi.com/structured/amazon/product/5b0c838a-d0eb-46c3-ad9a-e82e398d56a5",
"asin": "B079BLHH67"
"tld": ".com"
},
{
"id": "df83b9e1-be25-40de-8702-4e934f057867",
"status": "running",
"statusUrl": "http://async.scraperapi.com/structured/amazon/product/df83b9e1-be25-40de-8702-4e934f057867",
"asin": "B07G98GG51"
"tld": ".com"
}
]
After the job(s) finish, you will find the result under the response key in the response JSON object. The structure is the same as in the corresponding SYNC data endpoint.
Last updated
Was this helpful?