Reputation: 633
There are Developer API's and SDK's for Walmart, but these appear to be designed for general items like TV's, furniture, etc... does anybody happen to know if there is an SDK or API for Walmart Grocery? My use case is to populate a Walmart Grocery shopping cart programmatically for a given store.
Upvotes: 8
Views: 5619
Reputation: 574
For the walmart grocery api, you can use cURL to get a list of grocery items. In the example I provide below I will be using PHP (Guzzle/HTTP)
Search For Eggs (PHP)
$client = new Client(['base_uri' => 'https://grocery.walmart.com/v4/api/']);
$method = 'GET';
$path = 'products/search';
$query = [
'query' =>
[
'storeId' => '1855', //store location
'count' => 50,
'page' => 1,
'offset' => 0,
'query' => 'Egg Dozen'
]
];
$req = $client->request($method, $path, $query);
$data = json_decode($req->getBody()->getContents());
$products = $data->products;
print_r($products);
This will list off 50-60 grocery items based off of your search query.
Search For Eggs in cURL
curl -X GET \
'https://grocery.walmart.com/v4/api/products/search?storeId=1855&count=1&page=1&offset=0&query=eggs' \
-H 'Postman-Token: 1723fea5-657d-4c54-b245-027d41b135aa' \
-H 'cache-control: no-cache'
Not sure if that answered your question but I hope it is a start.
Upvotes: 1