Amazon Associate Product Advertising API for NodeJs. A maintained fork of the original PAAPI 5.0 Extension since the original is no longer maintained.
npm install @alonseg/amazon-paapibash
npm install amazon-paapi --save
`
Quickstart
`js
const amazonPaapi = require('amazon-paapi');
const commonParameters = {
AccessKey: '',
SecretKey: '',
PartnerTag: '', // yourtag-20
PartnerType: 'Associates', // Default value is Associates.
Marketplace: 'www.amazon.com', // Default value is US. Note: Host and Region are predetermined based on the marketplace value. There is no need for you to add Host and Region as soon as you specify the correct Marketplace value. If your region is not US or .com, please make sure you add the correct Marketplace value.
};
const requestParameters = {
ASIN: 'B07H65KP63',
Resources: [
'ItemInfo.Title',
'Offers.Listings.Price',
'VariationSummary.VariationDimension',
],
};
/* Promise /
amazonPaapi
.GetVariations(commonParameters, requestParameters)
.then((data) => {
// do something with the success response.
console.log(data);
})
.catch((error) => {
// catch an error.
console.log(error);
});
`
Usage
`js
const amazonPaapi = require('amazon-paapi');
const commonParameters = {
AccessKey: '',
SecretKey: '',
PartnerTag: '', // yourtag-20
PartnerType: 'Associates', // Default value is Associates.
Marketplace: 'www.amazon.com', // Default value is US. Note: Host and Region are predetermined based on the marketplace value. There is no need for you to add Host and Region as soon as you specify the correct Marketplace value. If your region is not US or .com, please make sure you add the correct Marketplace value.
};
`
$3
Lookup information for a Browse Node. Please see sample script here.
`js
const requestParameters = {
BrowseNodeIds: ['3040', '3045'],
LanguagesOfPreference: ['es_US'],
Resources: ['BrowseNodes.Ancestor', 'BrowseNodes.Children'],
};
/* Promise /
amazonPaapi
.GetBrowseNodes(commonParameters, requestParameters)
.then((data) => {
// do something with the success response.
console.log(data);
})
.catch((error) => {
// catch an error.
console.log(error);
});
`
$3
Lookup item information for an item. Please see sample script here.
> Note: This operation only supports ASIN as id Type. If you need to
> lookup using UPC or EAN, you can do so under SearchItems operation.
`js
const requestParameters = {
ItemIds: ['B00X4WHP5E', 'B00ZV9RDKK'],
ItemIdType: 'ASIN',
Condition: 'New',
Resources: [
'Images.Primary.Medium',
'ItemInfo.Title',
'Offers.Listings.Price',
],
};
/* Promise /
amazonPaapi
.GetItems(commonParameters, requestParameters)
.then((data) => {
// do something with the success response.
console.log(data);
})
.catch((error) => {
// catch an error.
console.log(error);
});
`
$3
Lookup information for variations. Please see sample script here.
`js
const requestParameters = {
ASIN: 'B07H65KP63',
Resources: [
'Images.Primary.Medium',
'ItemInfo.Title',
'Offers.Listings.Price',
'VariationSummary.VariationDimension',
],
};
/* Promise /
amazonPaapi
.GetVariations(commonParameters, requestParameters)
.then((data) => {
// do something with the success response.
console.log(data);
})
.catch((error) => {
// catch an error.
console.log(error);
});
`
$3
Searches for items on Amazon. Please see sample script here.
`js
const requestParameters = {
Keywords: 'Harry Potter',
SearchIndex: 'Books',
ItemCount: 2,
Resources: [
'Images.Primary.Medium',
'ItemInfo.Title',
'Offers.Listings.Price',
],
};
/* Promise /
amazonPaapi
.SearchItems(commonParameters, requestParameters)
.then((data) => {
// do something with the success response.
console.log(data);
})
.catch((error) => {
// catch an error.
console.log(error);
});
`
$3
- AccessKey - An alphanumeric token that uniquely identifies you. For information about getting an Access Key, see Register for Product Advertising API.
- SecretKey - A key that is used in conjunction with the Access Key to cryptographically sign an API request. To retrieve your Access Key or Secret Access Key, refer Register for Product Advertising API.
- PartnerTag - An alphanumeric token that uniquely identifies a partner. In case of an associate, this token is the means by which Amazon identifies the Associate to credit for a sale. If the value for PartnerType is Associate, specify the store ID or tracking ID of a valid associate store from the requested marketplace as the value for PartnerTag. For example, If store-20 and store-21 are store id or tracking id of customer in United States and United Kingdom marketplaces respectively, then customer needs to pass store-20 as PartnerTag in all PAAPI requests for United States marketplace and store-21 as PartnerTag` in all PAAPI requests for United Kingdom marketplace. To obtain an Partner Tag, see Sign up as an Amazon Associate.