dmcquay / node-apac

node-apac - Node.js client for the Amazon Product Advertising API, including support of Request Signatures
MIT License
499 stars 111 forks source link

Using response URL to obtain more results #89

Closed jsifalda closed 7 years ago

jsifalda commented 7 years ago

Hello, is there any example how it would look like when I want to use your lib to process response.result.ItemSearchResponse.Items.MoreSearchResultsUrl ??

Thanks in advance.

dmcquay commented 7 years ago

No I don't have an example of this.

ComputerCarl commented 7 years ago

@jsifalda Are you trying to use the URL for a specific reason? There is a setting undocumented in this modules which you can use an ItemPage setting.

const {OperationHelper} = require('apac');

const opHelper = new OperationHelper({
    awsId:     '[YOUR AWS ID HERE]',
    awsSecret: '[YOUR AWS SECRET HERE]',
    assocId:   '[YOUR ASSOCIATE TAG HERE]'
});

opHelper.execute('ItemSearch', {
  'SearchIndex': 'Books',
  'Keywords': 'harry potter',
  'ResponseGroup': 'ItemAttributes,Offers',
  'ItemPage` : 2 // or whatever the next page you're looking for
}).then((response) => {
    console.log("Results object: ", response.result);
    console.log("Raw response body: ", response.responseBody);
}).catch((err) => {
    console.error("Something went wrong! ", err);
});
jsifalda commented 7 years ago

ItemPage is great! thanks @ComputerCarl 👍