【发布时间】:2021-09-23 10:08:37
【问题描述】:
我有一个脚本可以将一些 ASIN 发送到亚马逊以检索他们的 FeeEstimates,我正在使用 php 客户端作为 api。
这是我的代码的主要部分:
$n = count($products);
$amazonFeesAux['MarketplaceId'] = 'my-market-place-id';
$amazonFeesAux['IdType'] = 'ASIN';
$amazonFeesAux['ListingPrice']['CurrencyCode'] = 'EUR';
$amazonFeesAux['IsAmazonFulfilled'] = true;
echo 'Total number of unique ASINs: ' . $n;
for($i = 1; $i <= $n; ++$i)
{
$amazonFeesAux['IdValue'] = $products[$i - 1]['ASIN'];
$amazonFeesAux['ListingPrice']['Value'] = $products[$i - 1]['price'];
$amazonFeesAux['Identifier'] = $i;
array_push($amazonFees, $amazonFeesAux);
if($i % $this->requestQuota == 0)
{
if (++$batchN > $this->requestQuota) sleep(2); // wait 2 seconds to restore 20 items before next request
echo "\n========================================= Batch number: " . $batchN . " =============================================== \n";
$newAmazonProductRanks = $this->getAmazonProductFeesData($amazonFees);
$amazonFees = []; // reset array as to re-populate with next batch
$this->updateProductFees($newAmazonProductRanks); <-- do something with the fees
}
}
在这里,我的 $products 只是我的 ASIN 数组,$this->getAmazonProductFeesData 只是我向亚马逊发送请求的函数。一切正常,但对于某些 ASIN,我得到一个模糊的 Client Side Error,看起来像这样:
有人知道我在这里做错了什么或错过了什么吗?
PS:此代码使用GetMyFeesEstimate原始MWS api请求。
【问题讨论】:
标签: php api client amazon amazon-mws