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

1

5

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.

Blazer answered 26/3, 2013 at 2:3 Comment(1)
I'm not sure i understood what you are trying to do but, i'm reading eBay's api documentation in this page http://developer.ebay.com/devzone/finding/Concepts/FindingAPIGuide so i thought you could use logical operator AND including all sizes in the same filter to have a more complete response, then use all returned data to display however you want in your programming language.Appendage
U
7

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!

Usm answered 3/4, 2013 at 23:12 Comment(5)
You might be onto something, but I'm not sure. 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." So even if you're correct, that I can get the shoe size by getting the search to return the SearchResult.item.attribute values for each item, I'm still unsure how how to ask for that information in my request. Any ideas on that? Thank you for your help.Blazer
I appreciate it, but that information simply isn't in the response. For example, this item: ebay.com/itm/… You'll see under item specifics it clearly lists "US Shoe Size (Men's): 14", but the default response XML doesn't have that information. See here for sample response: hdipreview.com/misc/ebay_api_response.jpgBlazer
Keep in mind, not that it should really matter as far as I know, but I am using findCompletedItems, not findItemsAdvanced.Blazer
Same for findItemsAdvanced though... no attributes: hdipreview.com/misc/finditemsadvanced.jpgBlazer
This is the only thing I can get to work: "looks like you have to use GetSingleItem with IncludeSelector=ItemSpecifics for the items you find via findCompletedItems" - at least that's some way to get the information I was looking for. I really appreciate your help - thank you.Blazer

© 2022 - 2024 — McMap. All rights reserved.