在Amazon API中,仅针对类别使用ItemSearch

Nom*_*man 2 php amazon amazon-web-services

我正在使用亚马逊产品广告API,我想检索一个类别的所有产品.我想知道的是,我只能在不将任何关键字传递到ItemSearch操作的情况下提供类别,并检索包括其子类别产品在内的完整产品记录集.

我尝试在数组中传递此参数而不提供"关键字"项:

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

但它不起作用.请帮我.

让我再简单解释一下,我想要的是通过传递任何类别而不传递任何关键字来获得完整的产品列表.

Mik*_*ant 6

你可能想要执行一个BrowseNodeLookup.此操作将允许您根据传递的浏览节点ID迭代地在祖先/子节点树中上下导航.

以下是该操作的文档:

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

顶级浏览节点ID列表如下:

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

然后,您可以使用您感兴趣的浏览节点ID,并将其作为参数值传递给ItemSearch.在这种情况下,您根本不需要包含关键字参数.

操作可能如下所示:

$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"       
);
Run Code Online (Sandbox Code Playgroud)