Home
Find the answer to your question
Trading API - C#.NET code sample to call GetSellingManagerInventory
Here is a sample code in C# using .NET for making an asynchronous GetSellingManagerInventory request. To use this sample, you will need to set a web reference to the eBay Web Service http://developer.ebay.com/webservices/latest/eBaySvc.wsdl
Code in the Program.cs file |
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 = new GetSellingManagerInventoryRequestType(); request.Version = ""VERSION"; GetSellingManagerInventoryResponseType response = new GetSellingManagerInventoryResponseType(); response = service.GetSellingManagerInventory(request); Console.Clear(); if (response.Ack == AckCodeType.Success) { Console.WriteLine("Ack: " + response.Ack); Console.WriteLine(); foreach (SellingManagerProductType smpType in response.SellingManagerProduct) { SellingManagerProductDetailsType smpDetails = new SellingManagerProductDetailsType(); 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 = new SellingManagerProductInventoryStatusType(); 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 in smpType.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, string url) { 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; } } }
|
Version Info
The code example above was based on the versions specified below:
API Schema Version |
681 |