For full functionality of this site it is necessary to enable JavaScript.
Here are the instructions how to enable JavaScript in your web browser.

Knowledge base

Find the answer to your question

Advanced Search PView

Search terms
Search Type
Product
Category
Language
Format
SDK
Sort by
Direction

Trading API - C#.NET code sample to call GetSellerList

  • Answer ID 1686
  • Published 08/19/2010 05:22 AM
  • Updated 10/20/2013 06:41 AM
  • Permalink https://ebaydts.com/eBayKBDetails?KBid=1686

Trading API - C#.NET code sample to call GetSellerList

 


Here is a sample code in C# using .NET for making an asynchronous GetSellerList 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 GetSellerList_Sample.com.ebay.developer;

using System.Configuration;

 

namespace GetSellerList_Sample

{

    class Program

    {

        private static void Execute_GetSellerList()

        {

            try

            {

                eBayAPIInterfaceService service = new eBayAPIInterfaceService();

                service = GeteBayCustomService("GetSellerList", "SignInURL");

                GetSellerListRequestType request = new GetSellerListRequestType();

                request.Version = myVersion;

                request.GranularityLevelSpecified = true;                
                request.GranularityLevel = GranularityLevelCodeType.Coarse;

                // Setting the date-range filter. This call required either EndTimeFrom & EndTimeTo pair OR StartTimeFrom & StartTimeTo pair

                // as a required input parameter.

                string strStartTimeFrom = "2010-02-15T00:00:00.000Z";

                string strStartTimeTo = "2010-05-17T23:59:59.999Z";

                request.StartTimeFromSpecified = true;

                request.StartTimeFrom = Convert.ToDateTime(strStartTimeFrom).ToUniversalTime();

                request.StartTimeToSpecified = true;

                request.StartTimeTo = Convert.ToDateTime(strStartTimeTo).ToUniversalTime();

                // Setting the Pagination which is a required input parameter for GetSellerList call

                PaginationType pagination = new PaginationType();

                pagination.EntriesPerPageSpecified = true;

                pagination.EntriesPerPage = 5;

                pagination.PageNumberSpecified = true;

                pagination.PageNumber = 1;

                request.Pagination = pagination;

 

                GetSellerListResponseType response = new GetSellerListResponseType();

                response = service.GetSellerList(request);

                Console.Clear();

                Console.WriteLine("Ack: " + response.Ack);

                if (response.Ack == AckCodeType.Success)

                {

                    PaginationResultType paginationResult = response.PaginationResult;

                    Console.WriteLine("TotalNumberOfPages: " + paginationResult.TotalNumberOfPages);

                    Console.WriteLine("TotalNumberOfEntries: " + paginationResult.TotalNumberOfEntries);

                    Console.WriteLine();

                    // Iterate through the ItemArray in the response for item details

                    foreach (ItemType item in response.ItemArray)

                    {

                        Console.WriteLine("ItemID: " + item.ItemID);

                        Console.WriteLine("Title: " + item.Title);

                        Console.WriteLine("-----------------------------");

                    }

                }

                else

                {

                    ErrorType[] errors = response.Errors;

                    foreach (ErrorType error in errors)

                    {

                        Console.WriteLine("ErrorCode: " + error.ErrorCode);

                        Console.WriteLine("Severity: " + error.SeverityCode);

                        Console.WriteLine("LongMessage: " + error.LongMessage);                       

                    }

                }

            }

            catch (Exception ex)

            {

                throw ex;

            }

        }

 

        private static eBayAPIInterfaceService GeteBayCustomService(string callName, string url)

        {

            eBayAPIInterfaceService service = new eBayAPIInterfaceService();

            try

            {

                myToken = "YOUR_TOKEN";

                myVersion = "VERSION";

                mySite = "SITEID";

                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

How well did this answer your question?

Answers others found helpful

Print Email This Page Delicious Digg Facebook Reddit StumbleUpon Twitter