If you want to obtain the information on a specific item from Amazon then you want to utilize the ItemLookup operation of the Amazon Product Advertising API. This operation returns the product that matches the user provided id.

Let’s get started by looking at an example on returning the book The Wise Man’s Fear by Patrick Rothfuss. The ASIN (Amazon Standard Identification Number) for this book happens to be 0756404738.

// Setup and Configure API
$api = new AmazonProductAPI();
... //set public,private, and associate key/id

// Setup Request
$request = new AmazonProduct_Request();
$request->Operation = AmazonProduct_Operation::ITEM_LOOKUP;
$request->ItemId = "0756404738";

// Send Request
$response = $api->search( $request );

// verify and use the response
if( $response->isSuccess() ) {
    $book = $response->items[0];
    echo $book->ItemAttributes->Title;

In this request there are a few items to take note of.

Setting the Operation to ItemLookup

The operation is set by the Operation variable of the AmazonProduct_Request object. You could pass in the string “ItemLookup” or use the ITEM_LOOKUP constants provided in the AmazonProduct_Operation class.

$request->Operation = "ItemLookup";

$request->Operation = AmazonProduct_Operation::ITEM_LOOKUP;

Setting the Product ID

To specify the product that you want returned you utilize the ItemId variable. The ItemLookup operation supports various ID Types but defaults to the ASIN if no specific type is specified.

$request->ItemId = "0756404738";

* Please note to use strings when dealing with IDs as if you use an int Amazon will not find the product as 756404738 is not the same as 0756404738.

Setting the ID Type (optional)

If by chance you don’t know the ASIN of a product there are other identifiers that can be used including SKU,UPC, and ISBN. To specify that you want to lookup a product by these variables you will need to set the IdType variable. Again you can use a string or the constants defined in the AmazonProduct_IdType class.

$request->IdType= "ISBN";

$request->IdType = AmazonProduct_IdType::ISBN;

Specifying your desired response types

The ItemLookup operation returns by default a product’s ASIN, DetailPageURL, Manufacturer, ProductGroup, and ItemAttributes (including Title). However if you wanted to return the product’s images or similar products you can specify that in the ResponseGroup variable by providing a comma delimited list of response groups.

$request->ResponseGroup = "MEDIUM," . AmazonProduct_ResponseGroup::IMAGES;

Full ItemLookup Documentation

To review the full set of options that can be utilized when performing an ItemLookup please visit the ItemLookup page of the Amazon Product Advertising API.

Comments & Questions

Add Your Comment