The walmart_search source is designed to retrieve Walmart search result pages. We can return the HTML for any Walmart page you like. Additionally, we can deliver structured (parsed) output for Walmart search pages.
Request samples
The example below illustrates how you can get a parsed Walmart search page result.
import requests
from pprint import pprint
# Structure payload.
payload = {
'source': 'walmart_search',
'query': 'iphone',
'parse': True,
}
# Get response.
response = requests.request(
'POST',
'https://realtime.oxylabs.io/v1/queries',
auth=('USERNAME', 'PASSWORD'),
json=payload,
)
# Instead of response with job status and results url, this will return the
# JSON response with the result.
pprint(response.json())
# The whole string you submit has to be URL-encoded.
https://realtime.oxylabs.io/v1/queries?source=walmart_search&query=iphone&parse=true&access_token=12345abcde
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Json;
using System.Threading.Tasks;
namespace OxyApi
{
class Program
{
static async Task Main()
{
const string Username = "USERNAME";
const string Password = "PASSWORD";
var parameters = new {
source = "walmart_searcg",
query = "iphone",
parse = true
};
var client = new HttpClient();
Uri baseUri = new Uri("https://realtime.oxylabs.io");
client.BaseAddress = baseUri;
var requestMessage = new HttpRequestMessage(HttpMethod.Post, "/v1/queries");
requestMessage.Content = JsonContent.Create(parameters);
var authenticationString = $"{Username}:{Password}";
var base64EncodedAuthenticationString = Convert.ToBase64String(System.Text.ASCIIEncoding.UTF8.GetBytes(authenticationString));
requestMessage.Headers.Add("Authorization", "Basic " + base64EncodedAuthenticationString);
var response = await client.SendAsync(requestMessage);
var contents = await response.Content.ReadAsStringAsync();
Console.WriteLine(contents);
}
}
}
package org.example;
import okhttp3.*;
import org.json.JSONObject;
import java.util.concurrent.TimeUnit;
public class Main implements Runnable {
private static final String AUTHORIZATION_HEADER = "Authorization";
public static final String USERNAME = "USERNAME";
public static final String PASSWORD = "PASSWORD";
public void run() {
JSONObject jsonObject = new JSONObject();
jsonObject.put("source", "walmart_search");
jsonObject.put("query", "iphone");
jsonObject.put("parse", true);
Authenticator authenticator = (route, response) -> {
String credential = Credentials.basic(USERNAME, PASSWORD);
return response
.request()
.newBuilder()
.header(AUTHORIZATION_HEADER, credential)
.build();
};
var client = new OkHttpClient.Builder()
.authenticator(authenticator)
.readTimeout(180, TimeUnit.SECONDS)
.build();
var mediaType = MediaType.parse("application/json; charset=utf-8");
var body = RequestBody.create(jsonObject.toString(), mediaType);
var request = new Request.Builder()
.url("https://realtime.oxylabs.io/v1/queries")
.post(body)
.build();
try (var response = client.newCall(request).execute()) {
if (response.body() != null) {
try (var responseBody = response.body()) {
System.out.println(responseBody.string());
}
}
} catch (Exception exception) {
System.out.println("Error: " + exception.getMessage());
}
System.exit(0);
}
public static void main(String[] args) {
new Thread(new Main()).start();
}
}
We use synchronous integration method in our examples. If you would like to use or asynchronous integration, refer to the section.
Request parameter values
Generic
Parameter
Description
Default Value
source
Sets the scraper.
walmart_search
query
The keyword or phrase to search for products.
-
min_price
Set the minimum price.
-
max_price
Set the maximum price.
-
sort_by
Select sorting of products. Available values are: price_low, price_high, best_seller, best_match.
best_match
render
-
parse
Returns parsed data when set to true.
false
callback_url
-
user_agent_type
desktop
- mandatory parameter
Localization
Adapt results to specific stores, shipping locations, etc.
Parameter
Description
Type
domain
Domain localization for Walmart.
String
fulfillment_speed
Set the fulfillment speed. Available values are: today, 2_days, anytime, tomorrow.
String
fulfillment_type
Set the fulfillment type. Available values are: in_store.
String
delivery_zip
Set the shipping to location.
String
store_id
Set the store location.
String
If target store is too far away from the given postal code - we will attempt to use the postal code of the target store, otherwise the location will not be set properly. In the case we can't set the delivery_zip - Walmart will return their default results without store targeting.
Structured data
In the following sections, parsed JSON code snippets are shortened where more than one item for the result type is available.
The table below presents a detailed list of each search page element we parse, along with its description and data type. The table also includes some metadata.
Key
Description
Type
url
The search page URL.
string
facets
An array containing details of any available search facets (refinements) shown on the search result page.
array
results
Search page results.
array
results.general
An object with general product details.
object
results.price
An object with pricing details of the product.
object
results.rating
Object contains details on product rating.
object
results.seller
Object contains seller information.
object
results.variants (optional)
Array contains a list of product variants.
array
results.fulfillment
Object contains details on product fulfillment options.
object
location
Provides information on the location in which the request was run in.
object
page_details
Object contains data on search query result page.
object
parse_status_code
integer
created_at
The timestamp when the scraping job was created.
timestamp
updated_at
The timestamp when the scraping job was finished.
timestamp
page
Page number from which the data was extracted
integer
url
The search page URL.
string
job_id
The ID of the job associated with the scraping job.
string
status_code
integer
is_render_forced
Identifies whether rendering has been forced for this request.
boolean
parser_type
Type of parser used for extracting the data (e.g., "walmart_search_new").
string
General
...
"general": {
"pos": 1,
"url": "/ip/Adidas-Men-s-California-2-0-Crew-Neck-Short-Sleeve-Tee-T-Shirt/833623567?classType=VARIANT",
"image": "https://i5.walmartimages.com/seo/Adidas-Men-s-California-2-0-Crew-Neck-Short-Sleeve-Tee-T-Shirt_1b8e0b00-fdc7-4b88-99fb-9a633bf0227b_1.812a96a559770448397cd828ef1cf68b.jpeg?odnHeight=180&odnWidth=180&odnBg=FFFFFF",
"title": "Adidas Men's California 2.0 Crew Neck Short Sleeve Tee T-Shirt",
"sponsored": true,
"product_id": "833623567",
"out_of_stock": false,
"section_title": "Results for \"adidas\""
},
...
Key (general)
Description
Type
pos
An indicator denoting the position of a given item within the section product is attributed to.
integer
url
The URL of the product.
string
image
The URL of the main product image.
string
title
Title or name of the product.
string
product_id
The ID of the product.
string
sponsored
Identifies if product is sponsored.
boolean
badge (optional)
Deal, popular pick, bestseller, 100+ bought since yesterday
list of strings
section_title
The name of the section which product is attributed to in the search page.