I'm trying to get all products priced between 12.50 and 11.50. I'm using Node-APAC for my requests to the Amazon Product API. Here's my code for a request:
exports.search = function(req, res){
OperationHelper = require('apac').OperationHelper;
var opHelper = new OperationHelper({
awsId: process.env.AMZ_ACCESS_KEY_CODE,
awsSecret: process.env.AMZ_SECRET_ACCESS_KEY,
assocId: process.env.AMZ_ASSOCIATE_ID
});
opHelper.execute('ItemSearch', {
'SearchIndex': 'All',
'Keywords': ' ',
'MaximumPrice': 12.50,
'MinimumPrice': 11.50,
'ResponseGroup': 'Medium'
}, function(error, results) {
res.send(results);
});
};
The response does not limit the results to a Medium ResponseGroup. You can see some of the full response here (It's huge). Here's the structure:
{
ItemSearchResponse: {
$: {...},
OperationRequest: [...],
Items: [
{
Request: [...],
TotalResults: [...],
TotalPages: [...],
MoreSearchResultsUrl: [...],
Item: [
{
ASIN: [...],
DetailPageURL: [...],
ItemLinks: [...],
SmallImage: [...],
MediumImage: [...],
LargeImage: [...],
ImageSets: [...],
ItemAttributes: [...],
OfferSummary: [...]
},
{...},
{...},
{...},
{...}
]
}
]
}
}
It is not returning what the documentation says should be included in the Medium ResponseGroup. It's returning a bunch of other stuff which is unnecessary. Any help is appreciated!
Note: It's also returning products that don't fit the price range. These problems may be related. Any tips there would be helpful.
As per the Amazon Product Advertising doc for the ItemSearch operation, MinimumPrice (resp. MaximumPrice) "specifies the minimum (resp. maximum) price of the items to return. Prices are in terms of the lowest currency denomination, for example, pennies, for example, 3241 represents $32.41.".
So if you change the values for the following two parameters:
'MaximumPrice': 12.50,
'MinimumPrice': 11.50,
with
'MaximumPrice': 1250,
'MinimumPrice': 1150,
the price filtering should work. As for the ResponseGroup, I would suggest you to pass "Small,OfferSummary" (as per my answer to your question "How to specify what Amazon Product API returns").