question

h0bojoe avatar image
0 Likes"
h0bojoe asked

Getting a List of Categories a Seller Has Items In

Hi, I have been trying to achieve this for a while, but I keep coming up short. Any help will be greatly appreciated. I am trying to get the list of eBay categories that a seller has items listed in, category title and category ID is the only data I am interested in. I am not interested in store categories. The following shows the content I am interested in: ![alt text][1] The only way I can think of is iterating over every item for the seller grabbing the primary category and then looking each up in the category tree. Which could be pretty call intensive. I found a similar question from 2013 in which it seemed that this wasn't possible, but maybe something has changed since then: https://forums.developer.ebay.com/questions/3600/can-i-get-somehow-ebay-categories-that-saler-have.html Any thoughts? Many thanks, Joe [1]: /storage/temp/1501-seller-categories.jpg
sellercategories list
seller-categories.jpg (133.7 KiB)
10 |600

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

h0bojoe avatar image
0 Likes"
h0bojoe answered
Thanks for the tips Click. I took your advice to use findItemsAdvanced and discovered the `outputSelector=CategoryHistogram` parameter which actually returns all of the category information I need in a single call. ([CategoryHistogram][1] docs) Even if you only request one item it returns *all* of the categories/child categories all top level categories and up to 10 of their immediate children (thanks @clickimusprime for pointing this out) that the seller has items listed in (including counts)! For example: http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsAdvanced&SERVICE-VERSION=1.13.0&SECURITY-APPNAME=[***APP ID***]&RESPONSE-DATA-FORMAT=XML&paginationInput.entriesPerPage=1&outputSelector=CategoryHistogram&itemFilter(0).name=Seller&itemFilter(0).value=[***SELLER ID***] My initial tests are looking really good. Thanks for your help. [1]: https://developer.ebay.com/devzone/finding/callref/types/CategoryHistogram.html
10 |600

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

clickimusprime avatar image
1 Like"
clickimusprime answered
You have to retrieve the items, then lookup the categories. You can store the category data used by your sellers as it doesn't change too often, but you'd still need to sync it periodically to make sure it's current. The least call-intensive approach I know uses a trick to get the category info from Shopping GetMultipleItems instead of making hundreds of category info calls. Do findItemsAdvanced calls to get all the items, make a list of the unique categories and one of the item numbers for each category, then request those items using GetMultipleItems to fetch them 20 at a time. That call returns the full category path without having to walk the tree. So this approach only requires one call per 20 unique categories. You get two nodes back that contain the full category hierarchy for the item and the corresponding category numbers. Collectibles:Comics:Copper Age (1984-1991):Superhero:Iron Man 1:63:165364:165386:165411 If these nodes were returned in the findItemsAdvanced, you wouldn't have to make any additional calls. Add your voice to this request. I've been asking for 4 years. https://forums.developer.ebay.com/questions/9322/feature-request-add-category-path-from-shopping-to.html Also watch out for categories with colons in the name: https://forums.developer.ebay.com/questions/16921/getcategoryinfo-namepaths.html
10 |600

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

clickimusprime avatar image
1 Like"
clickimusprime answered
Nice approach, if it works for you. Careful though, the response is limited to top level categories and up to 10 of their immediate children. It doesn't return 3rd level or lower, even if you specifically select an item. example: Item: 322574190093 GetSingleItem returns: 293:3270:60207:12040 The Finding histogram will return 293 and 3270 but not 60207 or 12040. The item category field will have 12040. For items 5 levels deep, two categories will be missing, etc. And those would probably be more important than the top level for most uses. You can't build a complete category hierarchy from that. So it doesn't suit all applications.
10 |600

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

h0bojoe avatar image
0 Likes"
h0bojoe answered
Good to know the limitations, thanks. I had noticed that not all child categories were being returned, but I hadn't quite worked out the logic yet. I believe this is sufficient for my application however, so I was happy to find an easy solution. I appreciate your time (as always).
10 |600

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.