有开发者的API和SDK的沃尔玛,但这些似乎是为一般项目,如电视,家具等.有没有人碰巧知道沃尔玛Grocery是否有SDK或API?我的用例是以编程方式为给定的商店填充一个Walmart Grocery购物车。
发布于 2018-12-05 18:37:58
对于沃尔玛食品杂货api,您可以使用cURL获取食品杂货清单。在下面提供的示例中,我将使用PHP (Guzzle/HTTP)
搜索鸡蛋(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); 这将根据您的搜索查询列出50-60个食品杂货。
搜索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'不确定这是否回答了你的问题,但我希望这是一个开始。
https://stackoverflow.com/questions/52140130
复制相似问题