phpamazon-web-servicesamazon-product-advertising-api

In Amazon API use ItemSearch with respect to category only


I am using Amazon Product Advertising API, I want to retrieve all products of a category. What I want to know is can I only provide a category without passing any Keyword into the ItemSearch operation and retrieve the complete set of product records including their sub-category products.

I tried passing this parameter in an array without supplying a 'Keyword' item:

$category = 'Software';    
$single = array(
      "Operation"     => "ItemSearch",
      "SearchIndex"   => $category,
      "Condition"     => "All",
      "ResponseGroup" => "Medium,Reviews"       
    );

But it does not work. Please help me.

Let me explain again in short that all I want is to get the complete list of Products by passing any category without passing any Keyword.


Solution

  • You would probably want to perform a BrowseNodeLookup. This operation will let you iteratively navigate up and down the tree of ancestors/children based on the passed Browse Node ID.

    Here is the documentation for that operation:

    http://docs.aws.amazon.com/AWSECommerceService/latest/DG/BrowseNodeLookup.html

    The list of top level Browse Node ID's is here:

    http://docs.aws.amazon.com/AWSECommerceService/latest/DG/BrowseNodeIDs.html

    You could then use the Browse Node Id that you are interested in and pass that in to the ItemSearch as a parameter value. You would not need to include the keyword parameter at all in this case.

    Operation might look like:

    $browse_node_id = '409488'; // browse node id for Software in US or other browse node determined by using BrowseNodeLoookup   
    $single = array(
      "Operation"     => "ItemSearch",
      "BrowseNode"    => $browse_node_id,
      "SearchIndex"   => "All", // we don't need to limit to certain category here as browse node does this
      "Condition"     => "All",
      "ResponseGroup" => "Medium,Reviews"       
    );