Walmart Search API (Async)

This endpoint will retrieve product list data from Walmart as a result of a search.

Single query request:

<?php

$curl = curl_init();

$data = json_encode(array(
    'apiKey' => 'APIKEY',
    'query' => 'QUERY',
    'output_format' => 'FORMAT',
    'tld' => 'TLD',
    'page' => 'PAGE',
    'callback' => array(
        'type' => 'webhook',
        'url' => 'CALLBACK'
    )
));

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://async.scraperapi.com/structured/walmart/search',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => $data,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

if (curl_errno($curl)) {
    echo 'Error:' . curl_error($curl);
} else {
    echo $response;
}

curl_close($curl);

?>

Multiple Query Request:

<?php

$curl = curl_init();

$data = json_encode(array(
    'apiKey' => 'APIKEY',
    'queries' => array('QUERY1', 'QUERY2'),
    'output_format' => 'FORMAT',
    'tld' => 'TLD',
    'page' => 'PAGE',
    'callback' => array(
        'type' => 'webhook',
        'url' => 'CALLBACK'
    )
));

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://async.scraperapi.com/structured/walmart/search',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => $data,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

if (curl_errno($curl)) {
    echo 'Error:' . curl_error($curl);
} else {
    echo $response;
}

curl_close($curl);

?>

Sample Response

For single query requests:

{
  "id": "2c75d8dc-02e9-4243-bef9-5da4bb352c4c",
  "status": "running",
  "statusUrl": "https://async.scraperapi.com/jobs/2c75d8dc-02e9-4243-bef9-5da4bb352c4c",
  "query": "bucket"
}

For multiple query requests:

[
  {
    "id": "b61d65c2-7998-41d5-8852-41175336d4b2",
    "attempts": 0,
    "status": "running",
    "statusUrl": "https://async.scraperapi.com/jobs/b61d65c2-7998-41d5-8852-41175336d4b2",
    "query": "bucket"
  },
  {
    "id": "e9d5a1b8-872c-4926-bb25-bc22c17c07bb",
    "attempts": 0,
    "status": "running",
    "statusUrl": "https://async.scraperapi.com/jobs/e9d5a1b8-872c-4926-bb25-bc22c17c07bb",
    "query": "sprinkler"
  }
]

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