Developers Program

GetCategories returns more information than the site ID specified

Published: May 08 2009, 4:18:00 PMยทUpdated: August 08 2022, 2:16:43 PM

Products

Question

When I make a GetCategories request and specify site ID 0, I get a bunch of motors stuff in the response. Similarly, when I make the same request to the motors site I get a bunch of non-motors stuff. How can I only get back category information relevant to the site I want?

Answer

GetCategories will attempt to return as much information as it can unless parameters are used to narrow the results. If only site specific information is desired, the CategorySiteID should be specified. Also be sure and set the correct site ID header in the request. A sample will look like the following:

<?xml version="1.0" encoding="utf-8"?>
<GetCategoriesRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<DetailLevel>ReturnAll</DetailLevel>
<Version>1219</Version>
<WarningLevel>High</WarningLevel>
<CategoryParent>20081</CategoryParent>
<CategorySiteID>0</CategorySiteID>
<LevelLimit>2</LevelLimit>
<ViewAllNodes>True</ViewAllNodes>
<RequesterCredentials>
</RequesterCredentials>
</GetCategoriesRequest>

How well did this answer your question?