Search code examples
phpamazon-mws

How to use ExcludeMe in Amazon MWS Products API GetLowestOfferListingsForASIN call


I am using Amazon MWS Products API for "GetLowestOfferListingsForASIN", Its working fine i just tried using this API call using scratchpad and i am getting this ExcludeMe option which i don't know how to use in my code because there is not any methods or class for that. Does anyone know how do i achieve this. My code is as below:

// 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);

Solution

  • The official API Reference doesn't list ExcludeMe as valid request parameter to GetLowestOfferListingsForASIN. It does, however list it for GetLowestOfferListingsForSKU. The current php library has methods for both. So an additional

    $request->setExcludeMe("True");
    

    before the invoke should do the trick.