AWS获取ASIN的库存数量

时间:2016-10-13 10:26:11

标签: php amazon-web-services

我试图通过使用ASIN获取每个亚马逊卖家的库存数量, using documentation

$param = array();
  $param['AWSAccessKeyId']   = "ACCESS_KEY";
  $param['Action']           = "ListInventorySupply"; 
  $param['SellerId']         = "SELLER_ID";
  $param['SignatureMethod']  = 'HmacSHA256'; 
  $param['SignatureVersion'] = '2'; 
  $param['Timestamp']        = gmdate("Y-m-d\TH:i:s\Z");
  $param['Version']          = '2010-10-01'; 
  $param['MarketplaceId']    = "ATVPDKIKX0DER";
  $param['ResponseGroup']    = 'Basic';
  $param['QueryStartDateTime']    = '2016-09-08T19:00:00Z';

$url = array();
foreach ($param as $key => $val) {

    $key = str_replace("%7E", "~", rawurlencode($key));
    $val = str_replace("%7E", "~", rawurlencode($val));
    $url[] = "{$key}={$val}";
}

  sort($url);

  $arr   = implode('&', $url);

  $sign  = 'GET' . "\n";
  $sign .= 'mws.amazonservices.com' . "\n";
      $sign .= '/FulfillmentInventory/2010-10-01' . "\n";
      $sign .= $arr;

      $signature = hash_hmac("sha256", $sign, "SECRET_KEY", true);
      $signature = urlencode(base64_encode($signature));

//I got this url correctly without errors
      $link  = "https://mws.amazonservices.com/FulfillmentInventory/2010-10-01?";
     echo $link .= $arr . "&Signature=" . $signature;  

但是在我的回复中我给出了一个gotempty库存供应清单,它显示在下面

<ListInventorySupplyResponse xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/">
    <ListInventorySupplyResult>
       <MarketplaceId>ATVPDKIKX0DER</MarketplaceId>
       <InventorySupplyList/>
   </ListInventorySupplyResult>
   <ResponseMetadata>
       <RequestId>582d8e1f-2094-4c04-bad8-98e003f59b8d</RequestId>
   </ResponseMetadata>
</ListInventorySupplyResponse>

所以,我想知道是否有可能获得所有卖家的库存数量?为什么我得到一个空的结果?提前谢谢。

0 个答案:

没有答案