aws-product-api
v1.2.5
Published
Simple service to send REST calls to Amazon Web Services Product Advertising API and return a Javascript Object
Downloads
5
Maintainers
Readme
Node.js client for Amazon Product Advertising API Version 2013-08-01
Installation
Install using npm:
npm install aws-product-api
Usage
Require library
amazon = require('aws-product-api');
Create REST Object
var RESTobj = new amazon("Secret_Key", "AWS_ID", "Associate_Tag");
Now you can search for items on amazon:
This is a complete implementation of the Product Advertising API, you must specify an Operation and any required entries.
ItemLookup:
RESTobj.Query({
Operation: "ItemLookup",
ItemID: "ID1,ID2",
ResponseGroup: "Large"
}, function(err, results) {
if (err) {
// err.Error: [ { Code: [ String ], Message: [ String ] } ]
} else {
// items: [ { Request: [ [ Object ] ], Item: [ [ Object ], [ Object ] ] } ]
}
});
RESTob.Query can return an es-6 Promise:
RESTobj.Query({
Operation: "ItemLookup",
ItemID: "ID1,ID2",
ResponseGroup: "Large"
}).then(function(items){
// items: [ { Request: [ [ Object ] ], Item: [ [ Object ], [ Object ] ] } ]
}).catch(function(err){
// err.Error: [ { Code: [ String ], Message: [ String ] } ]
});
###Query object options:
ASIN:
Default: None
Valid Values: Valid ASIN.
Constraint: Required if an OfferListingId is not specified.
Action:
Default: None
Valid Values:
- MoveToCart
- SaveForLater
CartId:
Default: None
Valid Values: Value returned by CartCreate.
CartItemId:
Default: None
Valid Values: Value returned by CartCreate or CartAdd.
Condition:
Default: New
Valid Values:
- Used
- Collectible
- Refurbished, All
HMAC:
Default: None
Valid Values: Value is calculated using request parameters, their values, a cryptographic function, and the Secret Key, which acts as the "key" for the function.
IdType:
Default: ASIN
Valid Values:
- SKU
- UPC
- EAN
- ISBN (US only, when search index is Books). UPC is not valid in the CA locale.
IncludeReviewsSummary:
Default: True
Valid Values:
- True
- False
Item:
For REST, a prefix for ASIN and quantity, both of which are used to specify the item to add to the cart, for example, item.1.ASIN=1234abcd, item.1.quantity=2. Valid Values: Use an array of objects e.g.
Item: [
{
ASIN: "ID1",
Quantity: 2
},
{
ASIN: "ID2",
Quantity: 1
}
];
ItemId:
Default: None
Constraints: Must be a valid item ID.
For more than one ID, use a comma-separated list of up to ten IDs.
MarketplaceDomain:
Valid values: Amazon
MerchantId:
Valid values: Amazon
OfferListingId:
Default: None
Valid Values: Valid offer listing ID.
Constraint: Required if ASIN is not offered
Operation:
Valid values:
- BrowseNodeLookup
- CartAdd
- CartClear
- CartCreate
- CartGet
- CartModify
- ItemLookup
- ItemSearch
- SimilarityLookup
Quantity:
Default: None
Valid Values: Positive integer between 1 and 999, inclusive
RelatedItemPage:
Valid values: Page Number
RelationshipType:
Goto RelationshipTypes to view valid values
ResponseGroup:
Default: Small
Valid Values:
- Accessories
- BrowseNodes
- EditorialReview
- Images
- ItemAttributes
- ItemIds
- Large
- Medium
- OfferFull
- Offers
- PromotionSummary
- OfferSummary| RelatedItems
- Reviews
- SalesRank
- Similarities
- Small
- Tracks
- VariationImages
- Variations (US only)
- VariationSummary You may use a comma separated list to return multiple Response Groups
SearchIndex:
Default: None
Valid Values: A search index, for example, Apparel, Beauty, Blended, Books, and so forth. For a complete of search indices, see Locale Reference.
Constraint:If ItemIdis an ASIN, a search index cannot be specified in the request.
Required for non-ASIN ItemIds.
SimilarityType:
Default: Intersection
Valid Value: Random
TruncateReviewsAt:
Valid values: Amazon
Validate:
True tests your request without returning results.
Default: False
Valid values: True, False
VariationPage:
Default: All
Valid Values: Integer between 1 and 150, inclusive
Version:
Default: 2013-08-01