C# 如何使用ebay api申请产品?
我如何致电易趣并要求其返回搜索结果阵列 这就是我到目前为止的想法:C# 如何使用ebay api申请产品?,c#,ebay-api,C#,Ebay Api,我如何致电易趣并要求其返回搜索结果阵列 这就是我到目前为止的想法: string endpoint = "https://api.ebay.com/wsapi"; string siteId = "0"; string appId = "*"; // use your app ID string devId = "*"; // use your dev ID string certId = "*"; // use your cert ID string version = "
string endpoint = "https://api.ebay.com/wsapi";
string siteId = "0";
string appId = "*"; // use your app ID
string devId = "*"; // use your dev ID
string certId = "*"; // use your cert ID
string version = "405";
string requestURL = endpoint
+ "?callname=FindProducts"
+ "&siteid=" + siteId
+ "&appid=" + appId
+ "&version=" + version
+ "&routing=default"
+ "&AvailableItemsOnly=true"
+ "&QueryKeywords=nvidia"
+ "&itemFilter(0).name=ListingType"
+ "&itemFilter(0).value(0)=FixedPrice"
+ "&itemFilter(0).value(1)=Auction"
+ "&CategoryID=27386";
如何将其封装到请求中,并以某种数据结构获得响应?我已经获得了SDK。我需要使用eBay查找API
public GetItemCall getItemDataFromEbay(String itemId)
{
ApiContext oContext = new ApiContext();
oContext.ApiCredential.ApiAccount.Developer = ""; // use your dev ID
oContext.ApiCredential.ApiAccount.Application = ""; // use your app ID
oContext.ApiCredential.ApiAccount.Certificate = ""; // use your cert ID
oContext.ApiCredential.eBayToken = ""; //set the AuthToken
//set the endpoint (sandbox) use https://api.ebay.com/wsapi for production
oContext.SoapApiServerUrl = "https://api.ebay.com/wsapi";
//set the Site of the Context
oContext.Site = eBay.Service.Core.Soap.SiteCodeType.US;
//the WSDL Version used for this SDK build
oContext.Version = "735";
//very important, let's setup the logging
ApiLogManager oLogManager = new ApiLogManager();
oLogManager.ApiLoggerList.Add(new eBay.Service.Util.FileLogger("GetItem.log", true, true, true));
oLogManager.EnableLogging = true;
oContext.ApiLogManager = oLogManager;
GetItemCall oGetItemCall = new GetItemCall(oContext);
//' set the Version used in the call
oGetItemCall.Version = oContext.Version;
//' set the Site of the call
oGetItemCall.Site = oContext.Site;
//' enable the compression feature
oGetItemCall.EnableCompression = true;
oGetItemCall.DetailLevelList.Add(eBay.Service.Core.Soap.DetailLevelCodeType.ReturnAll);
oGetItemCall.ItemID = itemId;
try
{
oGetItemCall.GetItem(oGetItemCall.ItemID);
}
catch (Exception E)
{
Console.Write(E.ToString());
oGetItemCall.GetItem(itemId);
}
GC.Collect();
return oGetItemCall;
}
他们为您提供了一个SDK.NET包装器,因此您不必手动处理这一切:。你试过了吗?你能给我一个例子来帮助我解决我的问题吗?请看这里的例子:。从那里,我相信会有一个名为
FindProducts
的方法,您可以使用手动输入到字符串中的参数调用该方法。您不必费心构建查询字符串、请求url、SOAP、响应等。我尝试创建“FindItemsByWordsRequest request=new FindItemsByWordsRequest();”但是获取消息者“错误1”找不到类型或命名空间名称“FindItemsByWordsRequest”(是否缺少using指令或程序集引用?),但引用在那里…:\