question

cargolargo avatar image
0 Likes"
cargolargo asked ·

Just the required fields from GetCategorySpecificsCall?

By piecing together several different pieces of documentation I've been able to call `GetCategorySpecifics` with a `CategoryIDList` to get each NameRecommendation for the category in the list (Only doing 1 catagoryID at a time) My current code looks like this GetCategorySpecificsCall cs = new GetCategorySpecificsCall(Context); cs.EnableCompression = true; cs.CategoryIDList = new StringCollection(); cs.CategoryIDList.Add(11104); //cookbook cs.MaxValuesPerName = 200; cs.DetailLevelList = new DetailLevelCodeTypeCollection(); cs.DetailLevelList.Add(DetailLevelCodeType.ReturnAll); cs.Execute(); I'm able to see the response in the log, and based on this KB (Knowledge Base) [KB link][1] I know that the `NameRecommendations` that have a `MinValues` of 1 are required for listing in the category specified (cookbooks is a bad category to use for this but...) So here is where I am stuck, how can I set a variable to only grab the `NameRecommendations` that have a `MinValues` of 1, and one or two `ValueRecommendations` My goal is to have each listing display the required fields and some example values for each field once the lister has selected the Category. I feel like I am pretty close, and there is likely an easy way to do this, I doubt I am the only one to have tried to do this. [1]: https://ebaydts.com/eBayKBDetails?KBid=1930
trading-apigetcategoryspecificstrading-sdkc# sdkrequired fieldsrecommendations
· 1
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

I've thought about parsing the log, but I feel like there is a better way to do it directly within the SDK/API
0 Likes 0 · ·

1 Answer

· Write an Answer
cargolargo avatar image
0 Likes"
cargolargo answered ·
Some more reading and experimenting I have come up with the following GetCategorySpecificsCall cs = new GetCategorySpecificsCall(Context); GetCategorySpecificsRequestType req = new GetCategorySpecificsRequestType(); req.CategoryID = cs.CategoryIDList; //still code above to set this, need to refactor GetCategorySpecificsResponseType r = (GetCategorySpecificsResponseType)cs.ExecuteRequest(req); Now I have the response in the variable r RecommendationsTypeCollection recommendations = r.Recommendations; foreach (NameRecommendationType nrt in recommendations[0].NameRecommendation) { List reccs = new List (); var name = nrt.Name; var required = nrt.ValidationRules.MinValues; if(required != 1) { continue; } foreach(ValueRecommendationType valuerec in nrt.ValueRecommendation) { reccs.Add(valuerec.Value); } } This skips the unrequired fields, and gives me access to the required field name, and a list of recommended values. Still need to refactor and make it a little more efficant and precise, but that is one way to achieve the goal. If there is an easier way feel free to enlighten with another answer.
· Share
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.