With most of the touchy-feely stuff dealt with in the module introduction and ItemSearch, we don't have to complicate ItemLookup. Here is the short and sweet: use ItemSearch to find the ASIN (Amazon product id) and then use ItemLookup to grab all of the information you need (and then some more).
item_lookup()
amazon:item_lookup({"item_id" : "B0017T0X9G"})
--Simplest possible item lookup. Uses the Amazon ASIN and returns the 'Small' Response Group by default
--Search for any related tracks to the specified item
amazon:item_lookup({"item_id" : ["C2002-WK"],
"idtype" : "SKU",
"merchant" : "All",
"response_group" : ["EditorialReview","Tags"],
"review_page" : 2,
"tag_page" : 3})
--Search by SKU (merchant parameter is required when you search by SKU) and return the 2nd page of reviews and 3rd page of tags associated with the items found
The secret sauce of the ItemLookup is in the Response Groups. From the Amazon documentation, valid Response Groups are:
The Accessories response group returns up to five ASINs and titles of accessories associated with items in the response. For example, if you performed an ItemLookup of a specific ASIN, say, a camera, and included in the request the Accessories response group, the response would include, by default, the titles and ASINs of up to the first ten accessories associated with the ASIN. The accessories for the camera might might include a camera case, lens, filters, and so forth.
The BrowseNodes response group returns the browse node names and IDs associated with the items returned in the response. The response group also returns the names and IDs of the child and parent browse nodes of the items returned in the response.
It is possible for one item to belong to multiple browse nodes. So, it is common to see multiple hierarchies of browse nodes for a single item.
Some products, such as parent ASINs, do not return information in the BrowsesNodes response group.
For each item in the response, the EditorialReview response group returns Amazon's review of the item, which, on the Detail page, is labeled the Product Description.
Copyrighted editorial reviews are not returned. For this reason, the reviews returned may be different than those returned by www.amazon.com.
The Images response group returns the URLs to all available images of an item in three sizes: small, medium, and large. For example, if a blender is for sale and there are four images of it, this response group returns the URLs of twelve images: four images, each in three sizes.
In addition to returning the URLs of the images, the response groups also returns the height and width dimensions of each image. Use these values to help you display the images correctly.
The images returned are associated with the merchant selling the item. For that reason, you must specify the merchant ID in the request when you use the Images response group. MerchantId, however, defaults to "Amazon." So, if the item is being sold by Amazon, specifying a MerchantId is not required. If you do not specify a MerchantId and a merchant other than Amazon is selling the item, Product Advertising API will not return images.
The ItemAttributes response group returns a potentially large number of attributes that describe an item. For example, an item in the Camera and Photo search index might return the attributes, height, width, weight, title, UPC, price, manufacture, zoom ratio, number of megapixels, and carrying case.
All search indices can return all item attributes. The number of item attributes returned, however, varies by ASIN. Typically, ASINs within the same search index return the same item attributes. For example, you would expect the item attributes returned for an item in the "Books" search index to be different from those returned for an item in the "Camera and Photo" search index. But all items within a single search index do not necessarily return the same attributes. For that reason, it is impossible to predict exactly which item attributes will be returned in a response
The Large response group returns a great deal of information about items in the response. Large is a parent response group that returns the results of the following response groups:
The Medium response group returns a great deal of information about the items in a response. The response group is ideally suited for creating lightweight, product detail pages
The MerchantItemAttributes response group returns merchant-specific information about a merchant's items for sale. The XML element tags returned by MerchantItemAttributes are the same as those returned by ItemAttributes. The values, however, returned by the response groups are mutually exclusive. The number of elements returned by MerchantItemAttributes is typically fewer than those returned by ItemAttributes because merchants typically change only a small subset of attributes returned by ItemAttributes
The OfferFull response group returns comprehensive information about an offer. OfferFull is a parent response group that returns the results of the Offers response group as well as:
The Offers response group is a parent response group that returns the contents of the OfferSummary response group plus, by default, seller and offer listing information. When Condition equals All, up to ten offers are returned sorted by price without regard to Condition. Offer listings are impacted by the values of the MerchantId and Condition parameters. As such, the total number of offer listings is dependent on the value of these parameters
The PromotionDetails response group returns detailed information about promotions (if any) related to items in a response. Included is information about the merchant offering the promotion, claim codes for the promotion, allowed promotion combinations, the type of promotion, beginning and ending dates of the promotion, the promotion ID, eligibility requirements, and text that describes the specifics of the promotion. A subset of this information is returned by the PromotionSummary response group.
A request that uses PromotionDetails must also include one of the following response groups:
Large
OfferFull
Offers
An error is returned if PromotionDetails is not accompanied by one of these response groups in the request
The PromotionSummary response group returns summary information about a promotion, including the type of promotion, beginning and ending dates of the promotion, the promotion ID, eligibility requirements, and text that describes the specifics of the promotion. This information is a subset of the information returned by the PromotionDetails response group.
PromotionSummary must be used along with one of the following response groups:
Large
OfferFull
Offers
An error is returned if ProductDetails is not accompanied by one of these response groups
The OfferSummary response group returns, for each item in the response, the number of offer listings and the lowest price for each condition type. Condition types are New, Used, Collectible, and Refurbished. So, for example, this response group returns the lowest price for each Condition:
New item
Used item
Collectible item
Refurbished item
Individual offer listings are not returned. The OfferSummary is dependent only on the ASIN parameter and is not affected by the MerchantId or Condition parameters (i.e. the OfferSummary will always be the same for a given ASIN independent of other parameters).
The RelatedItems response group returns items related to an item specified in an ItemLookup request. .Related items could be, for example, all of the Unbox episodes in a TV season that are sold separately, or, for example, all of the MP3Download tracks on a MP3 album.
The data returned for RelatedItems is limited to ASINs and ItemAttributes. This remains true even if you add additional response groups, such as Large, that would otherwise return additional data.
The relationship between items is unidirectional. One item is the parent and one item is the child. Items, however, can have multiple children or multiple parents for a given relationship type.
The way in which the items are related is specified by the RelationshipType parameter. This parameter is required when you use the RelatedItems response group. Some values include Episode, Season, Tracks, and Variation. For a list of all relationship types, go to the ItemLookup page.
The relationship type is usually named after the child item in the relationship. For example, an MP3 Track is related to an MP3 album and the type of relationship is Tracks. In this relationship, the album is the parent. If you did anItemLookup for an MP3 Track and requested RelatedItems using Tracks as the RelationshipType, you would receive the parent album (or albums) for that Track. Conversely, looking up an album using Tracks as the RelationshipTypereturns the list of Tracks on that album.
Each ItemLookup request can return, at most, ten related items. To return additional items, use the RelateditemsPageparameter. A value of 2, for example, returns the second set of ten related items
The SalesRank response group returns the sales rank for each item in the response. One is the highest rating; a large number means the item has not sold well. Sales rank is per Search Index so it is possible to have several items in one response ranked, for example, as 1
The Tags response group returns complete information about tags associated with specified items. Information includes the first and last time an item was tagged, how many times it was tagged, and who tagged it. For more information about tags, see Tags
The TagsSummary response group returns the items tagged by a specified tag. For more information about tags, seeTags.
In the tag-related response groups, Tags and TagSummary specify the amount of informtion returned. The other tag-related response groups, TaggedGuides, TaggedItems, and TaggedListmaniaLists, specify the kind of entity tagged
The Tracks response group returns the title and number of each track on each CD in the response. For example, you could use ItemLookup to return Tracks information about a specified CD
The VariationImages response group displays different image variations of the same item in four sizes: swatch, small, medium, and large, where the swatch image is smaller than the small image. VariationImages is used when there are variations of an item for sale. For example, a shirt for sale might come in four colors. If VariationImages is used as the response group, the shirt will be displayed in sixteen images: four image sizes of each of the four colors.
The images returned are associated with the merchant selling the item. For that reason, you must specify the merchant ID in the request when you use the VariationImages response group. MerchantId, however, defaults to "Amazon." So, if the item is being sold by Amazon, specifying a MerchantId is not required. If you do not specify a MerchantId and a merchant other than Amazon is selling the item, Product Advertising API will not return images.
Parent ASINs do not always have images associated with them; their children, however, should
The VariationMinimum response group returns all of the child ASINs of each parent ASIN in the response. For example, if the response contains the parent ASIN, Brand X T-Shirt, this response group will return the child ASINs for Brand X T-Shirt, including:
(US Locale only) The Variations response group is a parent response group that returns the contents of the VariationSummary and VariationMinimum response groups plus other variation details, such as item attributes, offers, and offer listings for each variation in the response
The VariationSummary response group provides the lowest price, highest price, lowest sale price, and highest sale price for all child ASINs in a response.
Parent ASINs do not have offers; their children do. For example, you cannot buy a shirt (the parent ASIN). You can, however, buy a shirt that is a certain color and size (the child ASIN)
ItemLookup
ItemLookup
With most of the touchy-feely stuff dealt with in the module introduction and ItemSearch, we don't have to complicate ItemLookup. Here is the short and sweet: use ItemSearch to find the ASIN (Amazon product id) and then use ItemLookup to grab all of the information you need (and then some more).
item_lookup()