技术文档
这是一个C#例程,使用 .NET 做一个GetSellingManagerInventory的异步请求。你需要设置与eBay Web Service的连接来实现这个例程: http://developer.ebay.com/webservices/latest/eBaySvc.wsdl
Program.cs文件内的代码 |
using System; using System.Collections.Generic; using System.Text; using GetSellingManagerInventory_Sample.com.ebay.developer; using System.Configuration;
namespace GetSellingManagerInventory_Sample { class Program { private static void Execute_GetSellingManagerInventory() { try { eBayAPIInterfaceService service = new eBayAPIInterfaceService(); service = GeteBayCustomService("GetSellingManagerInventory", "SignInURL"); GetSellingManagerInventoryRequestType request = newGetSellingManagerInventoryRequestType(); request.Version = ""VERSION"; GetSellingManagerInventoryResponseType response = newGetSellingManagerInventoryResponseType(); response = service.GetSellingManagerInventory(request); Console.Clear(); if (response.Ack == AckCodeType.Success) { Console.WriteLine("Ack: " + response.Ack); Console.WriteLine(); foreach (SellingManagerProductType smpType inresponse.SellingManagerProduct) { SellingManagerProductDetailsType smpDetails = newSellingManagerProductDetailsType(); Console.WriteLine(".:: Product Details ::."); Console.WriteLine("FolderID: " + smpDetails.FolderID); Console.WriteLine("ProductID: ", smpDetails.ProductID); Console.WriteLine("ProductName: ", smpDetails.ProductName); Console.WriteLine("QuantityAvailable: ", smpDetails.QuantityAvailable); Console.WriteLine(); SellingManagerProductInventoryStatusType smpiStatus = newSellingManagerProductInventoryStatusType(); smpiStatus = smpType.SellingManagerProductInventoryStatus; Console.WriteLine(".:: Product Inventory Status ::."); Console.WriteLine("QuantityActive: " + smpiStatus.QuantityActive); Console.WriteLine("QuantitySold: ", smpiStatus.QuantitySold); Console.WriteLine("QuantityUnsold: ", smpiStatus.QuantityUnsold); Console.WriteLine("SuccessPercent: ", smpiStatus.SuccessPercent); Console.WriteLine(); Console.WriteLine(".:: Template Details ::."); foreach (SellingManagerTemplateDetailsType smtDetails insmpType.SellingManagerTemplateDetailsArray) { Console.WriteLine("SaleTemplateID: " + smtDetails.SaleTemplateID); Console.WriteLine("SaleTemplateName: " + smtDetails.SaleTemplateName); } Console.WriteLine("--------------------------------"); Console.WriteLine(); } } else { } } catch (Exception ex) { throw ex; } }
private static eBayAPIInterfaceService GeteBayCustomService(string callName, stringurl) { eBayAPIInterfaceService service = new eBayAPIInterfaceService(); try { myToken = "YOUR_TOKEN"; myVersion = "VERSION"]; mySite = "SITE_ID"; signinURL = "SignInURL"]; string endpointURL = signinURL + "?callname=" + callName + "&siteid=" + mySite + "&version=" + myVersion + "&Routing=new"; service.Url = endpointURL; service.RequesterCredentials = new CustomSecurityHeaderType(); service.RequesterCredentials.eBayAuthToken = myToken; } catch (Exception ex) { throw ex; } return service; } } }
|
版本信息
上面例程基于此特定的API版本:
API Schema 版本 |
681 |
答案对您有帮助吗?
是,对我很有帮助 | |
否,没解决我的问题 |