简体   繁体   中英

Why does GetCategoriesCall return 0 categories?

I'm trying to get all root categories for eBay Germany using the eBay .Net SDK. I have this code:

var rootCategoriesCall = new GetCategoriesCall(apiContext);
rootCategoriesCall.Site = SiteCodeType.Germany;
rootCategoriesCall.LevelLimit = 1;
var categories = rootCategoriesCall.GetCategories().Cast<CategoryType>();

The call appears to be executed (there is the usual delay that accompanies eBay API calls) and it does not throw an error, yet I get 0 categories. Does anyone know what might be causing this behavior and how to fix it?

Note that I use a Sandbox token. As for the rootCategoriesCall.LevelLimit = 1; line. This site was suggesting it as a way of getting only the root categories.

PS I also tried setting CategorySiteID instead of Site and not setting it at all (it defaults to eBay US), but the result was the same.

I'm not entirely sure about why it is required, but it appears that I explicitly need to set DetailLevel . If I change my call to:

var rootCategoriesCall = new GetCategoriesCall(apiContext);
rootCategoriesCall.Site = SiteCodeType.Germany;
rootCategoriesCall.DetailLevelList.Add(DetailLevelCodeType.ReturnAll);
rootCategoriesCall.LevelLimit = 1;
var categories = rootCategoriesCall.GetCategories().Cast<CategoryType>();

I do get the root categories.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM