apa-client
Version:
An Amazon Product Advertising API client.
53 lines (41 loc) • 1.45 kB
Markdown
[](http://travis-ci.org/#!/lbdremy/apa-node-client)
```
npm install apa-client
```
- All operations with `Client
- Switch the locale with `Client
- Handle gracefully errors from the XMLParser, http request and specific APA API errors by always passing an `Error` has first argument in the callback.
```js
// Load dependency
var apa = require('apa-client');
// Create a client
var client = apa.createClient({
"awsAccessKeyId" : "", // your aws access key id here
"awsSecretKey" : "", // your secret key here
"associateTag" : "" // your associate tag here
});
// Switch locale (default endpoint is ecs.amazonaws.com)
client.switchLocale('fr'); // new endpoint is ecs.amazonaws.fr
// Execute 'ItemSearch' operation with few arguments
client.execute('ItemSearch',{
SearchIndex : 'All',
Keywords : 'TV Plasma',
ResponseGroup : 'OfferFull,Images,ItemAttributes,SalesRank,EditorialReview',
Availability : 'Available'
},function(err,data){
if(err) return console.error(err);
console.log(JSON.stringify(data));
});
```
Before running the tests create a file `config-private.json` containing your own credentials to create the client.
```js
npm test
```
(The MIT License)
Copyright 2012 HipSnip Limited