I need to execute a request using the .NET SDK, but the call wrapper does not have a method with the parameters that I need to send in. How should I make the call?
Summary
All the SDK call wrapper classes derive from the ApiCall class which has a no argument Execute method. You can use this to execute your request and pass in inputs by setting the properties of the call. This is also the recommended way of executing requests using the SDK.
Detailed Description
Lets take the example that you want to make a call to GetCharites and pass in only Query as the input. The SDK wrapper class GetCharitiesCall does not have a GetCharities method that takes just the Query as a parameter. In this case, you can set the Query as a property of the GetCharitiesCall object and run the Execute method. You can get the results of the response by accesssing the appropriate call property.
Here is a C# sample to demonstrate using the Execute method of the GetCharitiesCall class:
using System; using eBay.Service.Call; using eBay.Service.Core.Sdk; using eBay.Service.Util; using eBay.Service.Core.Soap;
namespace SDK3Examples {
public class GetCharities {
public void GetCharitiesUsingQuery(string query) { GetCharitiesCall apicall = new GetCharitiesCall(GetContext()); apicall.Query = query; apicall.Execute; // Get the Charity List CharityInfoTypeCollection charities = apicall.CharityList; }
public ApiContext GetContext() { ApiContext context = new ApiContext();
// Credentials for the call
context.ApiCredential.eBayToken = 'token';
// Set the URL context.SoapApiServerUrl = 'https://api.sandbox.ebay.com/wsapi';