Exemple #1
0
        public static void GetLevel2Categories(string topLevel)
        {
            eBayAPIInterfaceService service = EbayCalls.EbayServiceCall("GetCategories");

            GetCategoriesRequestType request = new GetCategoriesRequestType();

            request.Version        = "949";
            request.CategorySiteID = "3";
            request.LevelLimit     = 2;
            request.CategoryParent = new StringCollection {
                topLevel
            };
            request.DetailLevel = new DetailLevelCodeTypeCollection {
                DetailLevelCodeType.ReturnAll
            };
            GetCategoriesResponseType response = service.GetCategories(request);

            Console.WriteLine("==================");
            Console.WriteLine("Level 2 Categories");
            Console.WriteLine("==================");

            foreach (dynamic cat in response.CategoryArray)
            {
                Console.WriteLine("{0} - {1}", cat.CategoryID, cat.CategoryName);
            }
        }
Exemple #2
0
        public static void GetTopLevelCategories()
        {
            eBayAPIInterfaceService service = EbayCalls.EbayServiceCall("GetCategories");

            GetCategoriesRequestType request = new GetCategoriesRequestType();

            request.Version        = "949";
            request.CategorySiteID = "3";
            request.LevelLimit     = 1;
            request.DetailLevel    = new DetailLevelCodeTypeCollection {
                DetailLevelCodeType.ReturnAll
            };
            GetCategoriesResponseType response = service.GetCategories(request);

            Console.WriteLine("====================");
            Console.WriteLine("Top-Level Categories");
            Console.WriteLine("====================");
            foreach (dynamic cat in response.CategoryArray)
            {
                Console.WriteLine("{0} - {1}", cat.CategoryID, cat.CategoryName);
            }

            Console.WriteLine("====================");
            Console.WriteLine("Please enter a Top-Level Category ID: ");
            Console.WriteLine("====================");
            var topLevel = Console.ReadLine();

            GetLevel2Categories(topLevel);
        }
Exemple #3
0
        public static void AddItemRequest(ItemType item)
        {
            eBayAPIInterfaceService service = EbayCalls.EbayServiceCall("AddItem");

            AddItemRequestType request = new AddItemRequestType();

            request.Version       = "949";
            request.ErrorLanguage = "en_US";
            request.WarningLevel  = WarningLevelCodeType.High;
            request.Item          = item;

            AddItemResponseType response = service.AddItem(request);

            Console.WriteLine("Item Added");
            Console.WriteLine("ItemID: {0}", response.ItemID);
        }
Exemple #4
0
        public static void GetEbayDetailsRequest()
        {
            eBayAPIInterfaceService service = EbayCalls.EbayServiceCall("GetEbayDetails");

            GeteBayDetailsRequestType request = new GeteBayDetailsRequestType();

            request.Version    = "949";
            request.DetailName = new DetailNameCodeTypeCollection {
                DetailNameCodeType.ReturnPolicyDetails
            };

            GeteBayDetailsResponseType response = service.GeteBayDetails(request);

            Console.WriteLine("================");
            Console.WriteLine("Ebay request Details");
            Console.WriteLine("================");

            Console.WriteLine("Ack: {0}", response.Ack);
            Console.WriteLine("Version: {0}", response.Version);
            Console.WriteLine("Build: {0}", response.Build);
        }
Exemple #5
0
        public static void GetItemRequest(string itemID)
        {
            eBayAPIInterfaceService service = EbayCalls.EbayServiceCall("GetItem");

            GetItemRequestType request = new GetItemRequestType();

            request.Version = "949";
            request.ItemID  = itemID;
            GetItemResponseType response = service.GetItem(request);

            Console.WriteLine("=======================");
            Console.WriteLine("Item Title - {0}", response.Item.Title);
            Console.WriteLine("=======================");

            Console.WriteLine("ItemID: {0}", response.Item.ItemID);
            Console.WriteLine("Primary Category: {0}", response.Item.PrimaryCategory);
            Console.WriteLine("Listing Duration: {0}", response.Item.ListingDuration);
            Console.WriteLine("Start Price: {0}", response.Item.StartPrice);
            Console.WriteLine("Payment Type[0]: {0}", response.Item.PaymentMethods[0]);
            Console.WriteLine("PayPal Email Address: {0}", response.Item.PayPalEmailAddress);
            Console.WriteLine("Postal Code: {0}", response.Item.PostalCode);
        }
Exemple #6
0
        public static void GetCategoryFeaturesRequest(string CategoryID)
        {
            eBayAPIInterfaceService service = EbayCalls.EbayServiceCall("GetCategoryFeatures");

            GetCategoryFeaturesRequestType request = new GetCategoryFeaturesRequestType();

            request.Version      = "949";
            request.WarningLevel = WarningLevelCodeType.High;
            request.CategoryID   = CategoryID;
            request.FeatureID    = new FeatureIDCodeTypeCollection {
                FeatureIDCodeType.ConditionValues,
                FeatureIDCodeType.ListingDurations,
                FeatureIDCodeType.HandlingTimeEnabled,
                FeatureIDCodeType.MaxFlatShippingCost,
                FeatureIDCodeType.PayPalRequired,
                FeatureIDCodeType.BestOfferEnabled,
                FeatureIDCodeType.ReturnPolicyEnabled
            };

            request.DetailLevel = new DetailLevelCodeTypeCollection {
                DetailLevelCodeType.ReturnAll
            };
            GetCategoryFeaturesResponseType response = service.GetCategoryFeatures(request);

            Console.WriteLine("===============");
            Console.WriteLine("Category Features");
            Console.WriteLine("===============");

            Console.WriteLine("Ack: {0}", response.Ack);
            Console.WriteLine("Version: {0}", response.Version);
            Console.WriteLine("Build: {0}", response.Build);
            Console.WriteLine("Category Version: {0}", response.CategoryVersion);
            Console.WriteLine("Update Time: {0}", response.UpdateTime);
            Console.WriteLine("Return Policy Enabled: {0}", response.SiteDefaults.ReturnPolicyEnabled);
            Console.WriteLine("PayPal Required: {0}", response.SiteDefaults.PayPalRequired);
        }
Exemple #7
0
        public static void VerifyAddItemRequest()
        {
            eBayAPIInterfaceService service = EbayCalls.EbayServiceCall("verifyAddItem");

            VerifyAddItemRequestType request = new VerifyAddItemRequestType();

            request.Version       = "949";
            request.ErrorLanguage = "en_US";
            request.WarningLevel  = WarningLevelCodeType.High;

            var item = new ItemType();

            item.Title           = "My Title";
            item.Description     = "My Description";
            item.PrimaryCategory = new CategoryType {
                CategoryID = "11704"
            };
            item.StartPrice = new AmountType {
                Value = 7.98, currencyID = CurrencyCodeType.GBP
            };
            item.ConditionID     = 1000;
            item.Country         = CountryCodeType.GB;
            item.Currency        = CurrencyCodeType.GBP;
            item.DispatchTimeMax = 3;
            item.ListingDuration = "Days_7";
            item.ListingType     = ListingTypeCodeType.FixedPriceItem;
            item.PaymentMethods  = new BuyerPaymentMethodCodeTypeCollection {
                BuyerPaymentMethodCodeType.PayPal
            };
            item.PayPalEmailAddress = "testemail.gmail.com";
            item.PictureDetails     = new PictureDetailsType {
                PictureURL = new StringCollection {
                    "https://avatar-ssl.xboxlive.com/avatar/ii%20burg%20ii/avatar-body.png"
                }
            };
            item.PostalCode   = "[Enter Your PostCode]";
            item.Quantity     = 5;
            item.ReturnPolicy = new ReturnPolicyType
            {
                ReturnsAcceptedOption    = "Returns Accepted",
                ReturnsWithinOption      = "Days_30",
                RefundOption             = "MoneyBack",
                Description              = "Please feel free to return if you are not satisfied",
                ShippingCostPaidByOption = "Buyer"
            };
            item.ShippingDetails = new ShippingDetailsType
            {
                ShippingType           = ShippingTypeCodeType.Flat,
                ShippingServiceOptions = new ShippingServiceOptionsTypeCollection
                {
                    new ShippingServiceOptionsType {
                        ShippingServicePriority = 1,
                        ShippingService         = "UK_Parcelforce48",
                        ShippingServiceCost     = new AmountType {
                            Value      = 2.50,
                            currencyID = CurrencyCodeType.GBP
                        }
                    }
                }
            };
            item.Site = SiteCodeType.UK;

            request.Item = item;

            VerifyAddItemResponseType response = service.VerifyAddItem(request);

            Console.WriteLine("ItemID: {0}", response.ItemID);

            if (response.ItemID == "0")
            {
                Console.WriteLine("======================");
                Console.WriteLine("Add Item verified");
                Console.WriteLine("======================");
                AddItemRequest(item);
            }
        }