Home
Find the answer to your question
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.
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 Credentials for the call
}
context.ApiCredential.ApiAccount.Developer = "devID"; context.ApiCredential.ApiAccount.Application = "appID"; context.ApiCredential.ApiAccount.Certificate = "certID"; context.ApiCredential.eBayToken = "token"; // Set the Sandbox URL // Set logging // Set the version
return context;
}
} |
Version Info
The code example above was based on the versions specified below:
API Schema Version | 511 |
.NET SDK Version | eBay .NET SDK v511 Full Release |