Walmart Reviews API (Async)

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

Single query request

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import javax.net.ssl.HttpsURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
public class Main {
    public static void main(String[] args) {
        try {
            String apiKey = "APIKEY";
            String jsonInputString = "{"
                + "\"apiKey\": \"" + apiKey + "\", "
                + "\"productId\": \"PRODUCTID\", "
                + "\"page\": \"PAGE\", "
                + "\"tld\": \"TLD\", "
                + "\"sort\": \"SORT\", "
                + "}";

            URL url = new URL("https://async.scraperapi.com/structured/walmart/review");
            HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
            connection.setRequestMethod("POST");
            connection.setRequestProperty("Content-Type", "application/json");
            connection.setRequestProperty("Accept", "*/*");
            connection.setDoOutput(true);
            try (OutputStream os = connection.getOutputStream()) {
                byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8);
                os.write(input, 0, input.length);
            }
            int responseCode = connection.getResponseCode();
            StringBuilder response = new StringBuilder();
            BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
            String readLine;
            while ((readLine = in.readLine()) != null) {
                response.append(readLine);
            }
            in.close();
            if (responseCode == HttpURLConnection.HTTP_OK) {
                System.out.println("Response: " + response.toString());
            } else {
                throw new Exception("Error in API Call: Response code " + responseCode + "\nbody: " + response.toString());
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}

Multiple query request

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import javax.net.ssl.HttpsURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
public class Main {
    public static void main(String[] args) {
        try {
            String apiKey = "APIKEY";
            String jsonInputString = "{"
                + "\"apiKey\": \"" + apiKey + "\", "
                + "\"productId\": [\"PRODUCTID1\", \"PRODUCTID2\"], "
                + "\"page\": \"PAGE\", "
                + "\"tld\": \"TLD\", "
                + "\"sort\": \"SORT\", "
                + "}";

            URL url = new URL("https://async.scraperapi.com/structured/walmart/review");
            HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
            connection.setRequestMethod("POST");
            connection.setRequestProperty("Content-Type", "application/json");
            connection.setRequestProperty("Accept", "*/*");
            connection.setDoOutput(true);
            try (OutputStream os = connection.getOutputStream()) {
                byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8);
                os.write(input, 0, input.length);
            }
            int responseCode = connection.getResponseCode();
            StringBuilder response = new StringBuilder();
            BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
            String readLine;
            while ((readLine = in.readLine()) != null) {
                response.append(readLine);
            }
            in.close();
            if (responseCode == HttpURLConnection.HTTP_OK) {
                System.out.println("Response: " + response.toString());
            } else {
                throw new Exception("Error in API Call: Response code " + responseCode + "\nbody: " + response.toString());
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}

ParameterDetails

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

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