Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GetLowestPricedOffersForSKU failed processing arguments

Tags:

amazon-mws

I have a slight issue when trying to call GetLowestPricedOffersForSKU, I get the response :

Failed processing arguments of org.jboss.resteasy.spi.metadata

I can call other functions in the Product Api and they work fine, just get the above error on this function.

I have looked round the net for the answer but can't find anything that is related to this, does anybody have any idea why I'm getting this ?

By the way it all works fine in the MWS Scratchpad !

like image 699
Potman100 Avatar asked Mar 29 '16 19:03

Potman100


2 Answers

Posting in case anyone else comes to this and is as confused as I was. There is a fundamental difference with how nearly all Amazon MWS requests work except this particular one. All other requests technically accept the parameters as query parameters instead of POST data. The scratchpad even suggests this is how it is actually working (although the MWS Scratchpad actually sends the data as Post Data Fields also).

like image 79
Steve Eyre Avatar answered Oct 20 '22 11:10

Steve Eyre


MWS needs the POST data passed as form params instead of as a query string for some operations. Otherwise, it pukes a Failed processing arguments of org.jboss.resteasy.spi.metadata style 400 Bad Request error for some operations such as this one (GetMyFeesEstimate is another that suffers from this).

For instance, if you did the following POST request in Guzzle 6 then you'd likely get the error:

$response = $client->request('POST', 'https://mws.amazonservices.com/Products/2011-10-01/?AWSAccessKeyId=YOURAWSACCESSKEY&Action=GetLowestPricedOffersForASIN&SellerId=YOURSELLERID&MWSAuthToken=amzn.mws.fghsffg-4t44e-hfgh-dfgd-zgsdbfe5erg&SignatureVersion=2&Timestamp=2017-07-09T15%3A45%3A18%2B00%3A00&Version=2011-10-01&Signature=bCasdxXmYDCasdaXBhsdgse4pQ6hEbevML%2FJvzdgdsfdy2o%3D&SignatureMethod=HmacSHA256&MarketplaceId=ATVPDKIKX0DER&ASIN=B007EZK19E');

To fix this you'd submit it as form data as in this Guzzle 6 example:

$response = $client->request('POST', 'https://mws.amazonservices.com/Products/2011-10-01', [
    'form_params' => [
        'AWSAccessKeyId' => 'YOURAWSACCESSKEY',
        'Action' => 'GetLowestPricedOffersForASIN',
        'SellerId' => 'YOURSELLERID',
        'MWSAuthToken' => 'amzn.mws.fghsffg-4t44e-hfgh-dfgd-zgsdbfe5erg',
        'SignatureVersion' => 2,
        'Timestamp' => '2017-07-09T15%3A45%3A18%2B00%3A00',
        'Version' => '2011-10-01',
        'Signature' => 'bCasdxXmYDCasdaXBhsdgse4pQ6hEbevML%2FJvzdgdsfdy2o%3D',
        'SignatureMethod' => 'HmacSHA256',
        'MarketplaceId' => 'ATVPDKIKX0DER',
        'ASIN' => 'B007EZK19E',
    ]
]);
like image 34
eComEvo Avatar answered Oct 20 '22 11:10

eComEvo