Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

eBay Finding API - findCompletedItems - How to Return a Specific Aspect in Output

Tags:

ebay-api

I'm using findCompletedItems to look for all items matching a certain set of keywords in a certain category (Men's Shoes) and it's easy for me to specify that I only want all of a specific shoe size, using aspectFilter:

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

But if I want all results for the keywords and I want the output to include a specific aspect value (shoe size) for each result, even if they're not all the same, how would I go about doing that?

I've spent 3 hours hacking away using the API test tool and Googling for code samples, but I can't figure out how to query for all of the default data PLUS have any additional aspect(s) I'm after also be included in the output, without querying multiple times with aspectFilter for all of the different sizes, which is incredibly inefficient.

like image 689
Trae Avatar asked Mar 26 '13 02:03

Trae


1 Answers

You can't.

You can just build a request that specifies an outputSelector of type AspectHistogram. The response, however, will only include aggregated informations about the aspects of the items that your request selected. You can include how many outputSelectors you need, in the request, but aspects will be always aggregated, since (by definition) "aspects are item characteristics shared by items in a given domain" (read domain = search results).

Probably, what you are looking for are item attributes instead, that should already be present in the results, since they are specific of each item.

edit

According to the Call-specific Output Fields table for SearchResult.item.attribute: "The field is conditionally returned. See the field documentation for clarification of conditions."

This means that such attributes are specific of the item found: each attribute can be present in an item but not in an another. You don't have to do anything special to obtain them. You will find them in the <SearchResult> element, inside each <item>, each in an <attribute> element.

In the response XML you should find something like this:

<?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>

You can find more examples here and you can also go deeper in the XML result contents using this documentation.

edit 2
This seems to contraddict the documentation, that states:

Calls that use one or more fields of ItemAttribute:

findCompletedItems, findItemsAdvanced, findItemsByCategory, findItemsByKeywords, findItemsByProduct, findItemsIneBayStores

BTW, looks like you have to use GetSingleItem with IncludeSelector=ItemSpecifics for the items you find via findCompletedItems. I would try to hack the findItemsAdvanced api by passing "ItemSpecifics" as either IncludeSelector or OutputSelects. My final suggestion is to ask to customer service. Good luck!

like image 140
Giacomo Tesio Avatar answered Jan 01 '23 05:01

Giacomo Tesio