Skip to main content
Published: October 11 2006, 4:24:00 PMUpdated: August 19 2022, 4:48:13 AM

I am sending in the following GetCategories request:
<?xml version="1.0" encoding="utf-8"?>
  <
GetCategoriesRequest xmlns="urn:ebay:apis:eBLBaseComponents">

  <RequesterCredentials>
    <
eBayAuthToken>***</eBayAuthToken>
  </
RequesterCredentials>
  <Version>481</Version>
  <
LevelLimit>1</LevelLimit>
  <
DetailLevel>ReturnAll</DetailLevel>
  <
CategoryParent>0</CategoryParent>
</
GetCategoriesRequest>

However, this is what I get back in the response:

<?xml version="1.0" encoding="UTF-8" ?>
<GetCategoriesResponse xmlns="urn:ebay:apis:eBLBaseComponents">
  <Timestamp>2006-10-11T23:07:31.881Z</Timestamp>
  <Ack>Success</Ack> 
  <Version>481</Version>
  <Build>e481_core_Bundled_3650316_R1</Build>
  <CategoryArray />
  <CategoryCount>0</CategoryCount>
  <UpdateTime>2006-10-10T02:21:31.000Z</UpdateTime>
  <CategoryVersion>67</CategoryVersion>
  <ReservePriceInclusive>false</ReservePriceInclusive>
  <ReservePriceAllowed>true</ReservePriceAllowed>
  <MinimumReservePrice>0.0</MinimumReservePrice>

  <ReduceReserveInclusive>true</ReduceReserveInclusive>
  <ReduceReserveAllowed>false</ReduceReserveAllowed> 
</GetCategoriesResponse>

Why is it not returning any Category Nodes?


Summary

If you specify the CategoryParent in the GetCategories call, you need to ensure that you pass in a valid value.  0 is not a valid CategoryID and hence it does not return any Category node in the response. 


Detailed Description

In the example, if the intention is to get all the top level Categories, then do not send in the CategoryParent tag in the request.  It will automatically default to the root and return all the top level categories.

We do find that some developers pass in a value of -1. Although the call does seem to return the Category Nodes correctly, passing in negative values is not correct.  At the moment, the call is ignoring the negative value to, not passing in any CategoryParent tag.  However, you should not rely on this behavior and adopt the correct practice, which is to not send in the CategoryParent tag.

Here is the correct GetCategories call to return the top level categories:

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


Version Info

The code example above was based on the versions specified below:
 

API Schema Version 1267

 

 


 

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

Got thoughts? Click the feedback button – your insights help us improve!