Skip to main content
Published: April 22 2015, 3:46:00 PMUpdated: November 28 2020, 2:21:56 PM

My GetCategories call keeps timing out or taking very long to return. How can I retrieve all eBay Categories, without timing out.?

Retrieving all nodes with the GetCategories call in a single request can result in a very large response size, and load on your system. Even with compression, retrieving all nodes can be a very intensive process. One suggested approach to retrieve all eBay Categories, is to break your call in to multiple smaller calls. One common algorithm is given below.


1. Retrieve all Level 1 Categories for your Site ID. The call below shows you how to do this:

<?xml version="1.0" encoding="utf-8"?>
<GetCategoriesRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<CategorySiteID>0</CategorySiteID>
<DetailLevel>ReturnAll</DetailLevel>
<RequesterCredentials>
<eBayAuthToken>x</eBayAuthToken>
</RequesterCredentials>
<LevelLimit>1</LevelLimit>
</GetCategoriesRequest>

(Abbreviated Response )
<?xml version="1.0" encoding="utf-8"?>
<GetCategoriesResponse xmlns="urn:ebay:apis:eBLBaseComponents">
<Timestamp>2006-08-07T23:17:41.389Z</Timestamp>
<Ack>Success</Ack>
<Version>471</Version>
<Build>e471_core_Bundled_3273770_R1</Build>
<CategoryArray>
<Category>
<BestOfferEnabled>true</BestOfferEnabled>
<AutoPayEnabled>true</AutoPayEnabled>
<CategoryID>20081</CategoryID>
<CategoryLevel>1</CategoryLevel>
<CategoryName>Antiques</CategoryName>
<CategoryParentID>20081</CategoryParentID>
<Expired>false</Expired>
<IntlAutosFixedCat>false</IntlAutosFixedCat>
<LeafCategory>false</LeafCategory>
<Virtual>false</Virtual>
<ORPA>false</ORPA>
<LSD>false</LSD>
</Category>
<Category>
<BestOfferEnabled>true</BestOfferEnabled>
<AutoPayEnabled>true</AutoPayEnabled>
<CategoryID>550</CategoryID>
<CategoryLevel>1</CategoryLevel>
<CategoryName>Art</CategoryName>
<CategoryParentID>550</CategoryParentID>
<Expired>false</Expired>
<IntlAutosFixedCat>false</IntlAutosFixedCat>
<LeafCategory>false</LeafCategory>
<Virtual>false</Virtual>
<ORPA>false</ORPA>
<LSD>false</LSD>
</Category>
......
......
<Category>
<BestOfferEnabled>true</BestOfferEnabled>
<CategoryID>10159</CategoryID>
<CategoryLevel>1</CategoryLevel>
<CategoryName>Partner</CategoryName>
<CategoryParentID>10159</CategoryParentID>
<Expired>false</Expired>
<IntlAutosFixedCat>false</IntlAutosFixedCat>
<LeafCategory>false</LeafCategory>
<Virtual>false</Virtual>
<ORPA>false</ORPA>
<LSD>false</LSD>
</Category>
</CategoryArray>
<CategoryCount>35</CategoryCount>
<UpdateTime>2006-07-17T04:31:42.000Z</UpdateTime>
<CategoryVersion>64</CategoryVersion>
<ReservePriceInclusive>false</ReservePriceInclusive>
<ReservePriceAllowed>true</ReservePriceAllowed>
<MinimumReservePrice>0.0</MinimumReservePrice>
<ReduceReserveInclusive>true</ReduceReserveInclusive>
<ReduceReserveAllowed>false</ReduceReserveAllowed>
</GetCategoriesResponse>

2. For each Level 1 Category, call GetCategories with ViewAllNodes = True to return Sub-ParentIDs and Leaf Categories
For example, for the first Level1 Category, the GetCategoriesRequest would be:

<?xml version="1.0" encoding="utf-8"?>
<GetCategoriesRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<CategorySiteID>0</CategorySiteID>
<DetailLevel>ReturnAll</DetailLevel>
<RequesterCredentials>
<eBayAuthToken>x</eBayAuthToken>
</RequesterCredentials>
<CategoryParent>20081</CategoryParent>
<ViewAllNodes>True</ViewAllNodes>
</GetCategoriesRequest>

The GetCategoriesResponse would then contain all parent and leaf categories under 20081.



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