我正在使用亚马逊产品广告API,我想要检索某个类别的所有产品。我想知道的是,我只能提供类别,而不会将任何关键字传递到ItemSearch操作中,并检索包括其子类别产品在内的完整产品记录集。
我尝试在数组中传递此参数,而不提供“关键字”项:
$category = 'Software';
$single = array(
"Operation" => "ItemSearch",
"SearchIndex" => $category,
"Condition" => "All",
"ResponseGroup" => "Medium,Reviews"
);
但它不起作用。请帮帮我。
让我再简单解释一下,我想要的是通过传递任何类别而不传递任何关键字来获取完整的产品列表。
答案 0 :(得分: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"
);