如何在亚马逊MWS产品API GetLowestOfferListingsForASIN调用中使用ExcludeMe

时间:2014-09-05 08:25:09

标签: php amazon amazon-mws

我正在使用亚马逊MWS产品API用​​于" GetLowestOfferListingsForASIN",它的工作正常我只是尝试使用这个API调用使用暂存器,我得到这个ExcludeMe选项,我不知道如何使用在我的代码中,因为没有任何方法或类。 有谁知道我是如何实现这一目标的。我的代码如下:

// Including required files
$paths = array(
    get_include_path(),
    realpath(__DIR__ . '/../../AmazonProductsAPI/src/'),
);
set_include_path(implode(PATH_SEPARATOR, $paths));
unset($paths);
function __autoload($className)
{
    $filePath = str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
    $includePaths = explode(PATH_SEPARATOR, get_include_path());
    foreach($includePaths as $includePath)
    {
        if(file_exists($includePath . DIRECTORY_SEPARATOR . $filePath))
        {
            require_once $filePath;
            return;
        }
    }
}
$asin = "B000M5G1TW";
define('MERCHANT_ID', '123456789');
define('AWS_ACCESS_KEY_ID', 'AAAAAAAAAAAAAAA');
define('AWS_SECRET_ACCESS_KEY', 'SASASASASASASASASASASAS');

define('APPLICATION_NAME', 'MarketplaceWebServiceProducts PHP5 Library');
define('APPLICATION_VERSION', '2');

define('MARKETPLACE_ID', 'AAAAAAAWWWWWWWWWW');
define('MERCHANT_IDENTIFIER', 'MMMMMMMMMMMMMMMMMM');
define('DATE_FORMAT', 'Y-m-d');
$serviceUrl = "https://mws-eu.amazonservices.com/Products/2011-10-01";
$config = array(
    'ServiceURL' => $serviceUrl,
    'ProxyHost' => null,
    'ProxyPort' => -1,
    'MaxErrorRetry' => 3,   
);

$service = new MarketplaceWebServiceProducts_Client(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, APPLICATION_NAME, APPLICATION_VERSION, $config);

$request = new MarketplaceWebServiceProducts_Model_GetLowestOfferListingsForASINRequest();
$request->setSellerId(MERCHANT_ID);
$request->setMarketplaceId(MARKETPLACE_ID);
$request->setItemCondition("New");

$asin_list = new MarketplaceWebServiceProducts_Model_ASINListType();
$asin_list->setASIN($asin);
$request->setASINList($asin_list);

$data = invokeGetLowestOfferListingsForASIN($service, $request);
print_r($data);

1 个答案:

答案 0 :(得分:1)

官方API Reference未将ExcludeMe列为GetLowestOfferListingsForASIN的有效请求参数。但它会为GetLowestOfferListingsForSKU列出它。当前的php库有两种方法。另外一个

$request->setExcludeMe("True");

在调用之前应该做的伎俩。