Find the answer to your question
Advanced Search
How can I set the DetailLevel or GranularityLevel for a call using the .NET SDK?
Summary
To set the DetailLevel for a call, you need to add the required DetailLevelCodeType to the call's DetailLevelList collection. For GranularityLevel, you need to set the required GranularityLevelCodeType to the call's GranularityLevel property.
Detailed Description
Here are a couple of samples written in C# which demonstrate how to set the DetailLevel and GranularityLevel:
using System; using eBay.Service.Call; using eBay.Service.Core.Sdk; using eBay.Service.Util; using eBay.Service.Core.Soap; namespace SDKExamples public class Samples } { public ApiContext context; public string GetItem(string ItemID)
{ GetItemCall apicall = new GetItemCall(GetContext()); //Set the DetailLevel to get the Attribute Information apicall.DetailLevelList.Add(DetailLevelCodeType.ItemReturnAttributes); apicall.ItemID = "110021195125"; apicall.Execute(); //Get the information from the response string title = apicall.Item.Title; } public void GetSellerList() { GetSellerListCall apicall = new GetSellerListCall(GetContext()); TimeFilter tf = new TimeFilter(); tf.TimeFrom = DateTime.Now.AddMinutes(1); tf.TimeTo = DateTime.Now.AddDays(30); apicall.EndTimeFilter = tf; //Set the GranularityLevel to Coarse apicall.GranularityLevel = GranularityLevelCodeType.Coarse; apicall.Pagination = new PaginationType(); apicall.Pagination.EntriesPerPage = 200; apicall.Pagination.PageNumber = 1; apicall.Execute(); //Process each item foreach( ItemType item in apicall.ItemList) { //do the processing } //Get more pages if required, by incrementing apicall.Pagination.PageNumber } public ApiContext GetContext() // Set the Sandbox API Credentials for the call }
context.ApiCredential.eBayToken = "token"; // Set the Sandbox URL // Set logging // Set the version return context; }
} |
Additional Resources
How well did this answer your question?
Answers others found helpful
- Using GetSellerList to retreve a seller's items that were not listed in the certain categories in Java SDK
- How can I get a list of my active items?
- Using GetBidderList to retrieve all items that a buyer has won from a seller
- How to not retrieve the description with GetItemCall
- Call is not returning all the fields for an object