Search code examples
phpamazon-web-servicesamazon-mws

amazon Marketplace PHP Pricing api


working on PHP amazon marketplace api, to get the products and offers. I'm trying this sample : GetMatchingProductForIdSample.php

I get this error :

Caught Exception: Access to Products.GetMatchingProductForId is denied Response Status Code: 401 Error Code: AccessDenied Error Type: Sender Request ID: 8abfa898-cf9b-448e-8843-44ebb65c560c XML: Sender AccessDenied Access to Products.GetMatchingProductForId is denied 8abfa898-cf9b-448e-8843-44ebb65c560c ResponseHeaderMetadata: RequestId: 8abfa898-cf9b-448e-8843-44ebb65c560c, ResponseContext: Vr9BfReJTpsZptHmpSn3qWIs9jaQyEXRMzCHPIzpLSp4GqT2gEHL02Cj/L2Vrygv47yEL11ksSeS fbdrOlJyxg==, Timestamp: 2014-09-17T15:01:38.384Z, Quota Max: , Quota Remaining: , Quota Resets At:

After checking my configuration on the others samples, it appears that my configuration is ok. This is the request i'm making, using EAN, but it still doesn't work :

$request = new MarketplaceWebServiceProducts_Model_GetMatchingProductForIdRequest();
$request->setSellerId(MERCHANT_ID);
$request->setIdType("EAN");
$list = new MarketplaceWebServiceProducts_Model_IdListType();
$list->setId("5039036029667");
$request->setIdList($list);

Do you have any ideas?


Solution

  • (I'm using sample code in https://github.com/choomz/amazon-mws-sdk/blob/master/search/src/MarketplaceWebServiceProducts/Samples/GetMatchingProductForIdSample.php, if not the correct one, please let me know)

    Amazon is returning HTTP Code 401 that is Access Forbidden (you can find more info about Status Codes here: http://en.wikipedia.org/wiki/List_of_HTTP_status_codes)

    That causes a MarketplaceWebServiceProducts_Exception to be thrown when trying to fetch the products in the following line:

    https://github.com/choomz/amazon-mws-sdk/blob/master/search/src/MarketplaceWebServiceProducts/Samples/GetMatchingProductForIdSample.php#L93

    Based on the information you provided, it seems that there is an issue with the Credentials that you are using to connect to Amazon Service.

    Please make sure that all the information required in config.inc file is completed and it's correct and then try again.