eBay Finding API - findCompletedItems - 如何返回输出中的特定方面

时间:2013-03-26 02:03:36

标签: api ebay

我正在使用findCompletedItems来查找与特定类别(Men's Shoes)中的某组关键字匹配的所有项目,并且我很容易指定我只想要所有特定的鞋码,使用aspectFilter:

<aspectFilter>
   <aspectName>US Shoe Size (Men's)</aspectName>
   <aspectValueName>11</aspectValueName>
</aspectFilter>

但是,如果我想要关键字的所有结果,并且我希望输出包含每个结果的特定方面值(鞋码),即使它们不完全相同,我将如何去做?< / p>

我花了3个小时黑客使用API​​测试工具和谷歌搜索代码示例,但我无法弄清楚如何查询所有默认数据PLUS有任何其他方面我追求也可以包含在输出中,不需要使用aspectFilter多次查询所有不同的大小,这是非常低效的。

1 个答案:

答案 0 :(得分:7)

你做不到。

您只需构建一个指定outputSelector type AspectHistogram的请求即可。但是,回复只会包含aggregated informations有关您的请求所选项目的各个方面的信息。您可以在请求中包含所需的outputSelectors数量,但方面将始终聚合,因为(根据定义)“aspects are item characteristics shared by items in a given domain”(读取域=搜索结果)。

或许,你要找的是item attributes,而这应该已经存在于结果中,因为它们是每个项目的具体内容。

修改

  

根据特定于呼叫的输出字段表    SearchResult.item.attribute :“有条件地返回该字段。请参阅字段文档以了解条件。”

这意味着此类属性特定于找到的项目:每个属性可以存在于项目中但不能存在于另一个项目中。 您无需执行任何特殊操作即可获取它们。您可以在每个<SearchResult>内的<item>元素中找到它们,每个元素位于<attribute>元素中

在响应XML中,您应该找到类似这样的内容:

<?xml version="1.0" encoding="utf-8"?>
<findItemsAdvancedResponse xmlns="http://www.ebay.com/marketplace/search/v1/services">
  <!-- various things here... -->
  <searchResult count="1">
  <item>
    <attribute>
      <name>Size</name>
      <value>XXL</value>
    </attribute>
    <!-- ... more attribute nodes allowed here ... -->
    <!-- ... more item info here ... -->
  </item>
  <!-- ... more items ... -->
  </searchResult>
</findItemsAdvancedResponse>

您可以找到更多示例here,您还可以使用this documentation更深入地了解XML结果内容。

编辑2
这似乎与documentation相矛盾,其中指出:

  

使用ItemAttribute的一个或多个字段的调用:

     
    

findCompletedItems,findItemsAdvanced,findItemsByCategory,findItemsByKeywords,findItemsByProduct,findItemsIneBayStores

  

顺便说一下,对于您通过 findCompletedItems 找到的项目,您必须使用GetSingleItem IncludeSelector = ItemSpecifics 。我会尝试通过将“ItemSpecifics”作为IncludeSelector或OutputSelects传递来破解 findItemsAdvanced api。我的最后建议是问customer service。祝你好运!