I am working on Walmart Api Integration, using Laravel 7. I had installed the GuzzleHttp too. I used DigitalSignatureUtil.jar to generate WM_SEC.AUTH_SIGNATURE and WM_SEC.TIMESTAMP. It works fine to fetch data in json at first time. The following is the code.
$client = new GuzzleHttp\Client();
$res = $client->request('GET', 'https://marketplace.walmartapis.com/v3/feeds', [
'headers' => [
'WM_SVC.NAME' => 'walmart market place',
'WM_CONSUMER.ID' => '#########',
'WM_QOS.CORRELATION_ID' => '########',
'WM_CONSUMER.CHANNEL.TYPE' => '######',
'WM_SEC.AUTH_SIGNATURE' => '#######',
'WM_SEC.TIMESTAMP' => '1596290047006',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
]
]);
$products = json_decode((string) $res->getBody(), true);
return view('product', compact('products'));
NOTE: But it gives errors if i use the code next day, or after few minutes. I get following error
GuzzleHttp\Exception\ClientException
Client error: `GET https://marketplace.walmartapis.com/v3/feeds` resulted in a `401 Unauthorized`
response: {"error": [{"code":"UNAUTHORIZED.GMP_GATEWAY_API",
"field":"UNAUTHORIZED","description":"Unauthorized","info":"Unauthorize (truncated...)
Please help me what should i do to get rid from this?