Walmart Reviews API: Async Structured Data in Ruby

Scrape Walmart product reviews into structured JSON/CSV using ScraperAPI async in Ruby. Filter by rating, date, or relevance. Ideal for sentiment and UX analysis.

This endpoint will retrieve reviews for a specified product from a Walmart reviews page and transform it into usable JSON.

Single query request

require 'net/http'
require 'json'
require 'uri'
uri = URI('https://async.scraperapi.com/structured/walmart/review')
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = {
  apiKey: 'APIKEY',
  productId: 'PRODUCTID',
  page: 'PAGE',
  tld: 'TLD',
  sort: 'SORT',
  }
}.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 query request

require 'net/http'
require 'json'
require 'uri'
uri = URI('https://async.scraperapi.com/structured/walmart/review')
request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
request.body = {
  apiKey: 'APIKEY',
  productIds: ['PRODUCTID1','PRODUCTID2'],
  page: 'PAGE',
  tld: 'TLD',
  sort: 'SORT',
  }
}.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

Parameter
Details

api_key

Your API Key.

product_id

Walmart Product id. Example: 5253396052

sort

Sort by option. Valid values are:

relevancy helpful submission-desc submission-asc rating-desc rating-asc

ratings

Comma-separated number list of review ratings. Supported values: 1,2,3,4,5 - used in any combination.

verified_purchase

Boolean - true or false. Filters reviews only from verified purchases when set to true.

page

Specify the page number

TLD

Top level domain. Valid values are com and ca

Sample Response

For single query request

{
  "id": "aaaff531-cf95-4d8c-a0bc-0b3422c89d6b",
  "attempts": 0,
  "status": "running",
  "statusUrl": "https://async.scraperapi.com/jobs/aaaff531-cf95-4d8c-a0bc-0b3422c89d6b",
  "productId": "5253396052",
  "page": "3",
  "supposedToRunAt": "2024-07-01T19:49:21.577Z"
}

For multiple query requests

[
  {
    "id": "182104d3-0a6b-47df-8ca4-06da43c5dae0",
    "attempts": 0,
    "status": "running",
    "statusUrl": "https://async.scraperapi.com/jobs/182104d3-0a6b-47df-8ca4-06da4335dae0",
    "productId": "5253396052",
    "page": "3"
  },
  {
    "id": "477e21c1-5d12-4c88-a347-1997e64b9436",
    "attempts": 0,
    "status": "running",
    "statusUrl": "https://async.scraperapi.com/jobs/477e21c1-5d12-4c88-a347-1997e23b9436",
    "productId": "41FV2JGSJPXI",
    "page": "3"
  }
]

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?