Skip to main content
Published: February 15 2011, 2:23:00 AMUpdated: September 10 2022, 12:12:42 AM

I have a product with me (say iPhone 3GS). How can I programmatically find out which is the right category to list the item ?

 The Trading API requires a Category ID for most of the category related operations and Listing operation. Identifying what category and item belongs to is a bit difficult for some one who is new to eBay and its APIs.

The Trading API provides GetSuggestedCategories call which can suggest most probable category(ies) that an Item can be listed in based on keywords that are provided as an input.

Here's an example :

<?xml version="1.0" encoding="utf-8"?>
<GetSuggestedCategoriesRequest xmlns="urn:ebay:apis:eBLBaseComponents">
  <RequesterCredentials>
    <eBayAuthToken>ABC...123</eBayAuthToken>
  </RequesterCredentials>
  <Query>iPhone 4 Hard Case</Query>
</GetSuggestedCategoriesRequest>


<?xml version="1.0" encoding="utf-8"?>
<GetSuggestedCategoriesResponse xmlns="urn:ebay:apis:eBLBaseComponents">
  <Timestamp>2011-05-05T05:31:21.602Z</Timestamp>
  <Ack>Success</Ack>
  <Version>719</Version>
  <Build>E719_CORE_BUNDLED_13126991_R1</Build>
  <SuggestedCategoryArray>
    <SuggestedCategory>
      <Category>
        <CategoryID>20349</CategoryID>
        <CategoryName>Cases, Covers &amp; Skins</CategoryName>
        <CategoryParentID>15032</CategoryParentID>
        <CategoryParentID>9394</CategoryParentID>
        <CategoryParentName>Cell Phones &amp; PDAs</CategoryParentName>
        <CategoryParentName>Cell Phone &amp; PDA Accessories</CategoryParentName>
      </Category>
      <PercentItemFound>63</PercentItemFound>
    </SuggestedCategory>
    <SuggestedCategory>
      <Category>
        <CategoryID>42425</CategoryID>
        <CategoryName>Other</CategoryName>
        <CategoryParentID>15032</CategoryParentID>
        <CategoryParentID>9394</CategoryParentID>
        <CategoryParentName>Cell Phones &amp; PDAs</CategoryParentName>
        <CategoryParentName>Cell Phone &amp; PDA Accessories</CategoryParentName>
      </Category>
      <PercentItemFound>10</PercentItemFound>
    </SuggestedCategory>
    <SuggestedCategory>
      <Category>
        <CategoryID>45068</CategoryID>
        <CategoryName>Cases, Covers &amp; Skins</CategoryName>
        <CategoryParentID>15032</CategoryParentID>
        <CategoryParentID>45065</CategoryParentID>
        <CategoryParentID>45066</CategoryParentID>
        <CategoryParentName>Cell Phones &amp; PDAs</CategoryParentName>
        <CategoryParentName>Wholesale Lots</CategoryParentName>
        <CategoryParentName>Parts &amp; Accessories</CategoryParentName>
      </Category>
      <PercentItemFound>9</PercentItemFound>
    </SuggestedCategory>
    <SuggestedCategory>
      <Category>
        <CategoryID>56170</CategoryID>
        <CategoryName>Cases</CategoryName>
        <CategoryParentID>293</CategoryParentID>
        <CategoryParentID>56169</CategoryParentID>
        <CategoryParentName>Consumer Electronics</CategoryParentName>
        <CategoryParentName>iPod &amp; MP3 Accessories</CategoryParentName>
      </Category>
      <PercentItemFound>6</PercentItemFound>
    </SuggestedCategory>
  </SuggestedCategoryArray>
  <CategoryCount>4</CategoryCount>
</GetSuggestedCategoriesResponse>

You can take a look at the category Name and decide which category you want to list in. Pass in the CategoryID value inside the ParentCategory.CategoryID in the Add request.
 

 

How well did this answer your question?
Answers others found helpful