Skip to main content
Published: June 09 2011, 5:38:00 AMUpdated: November 28 2020, 9:48:43 PM

If you list an item with product data, your item has better chances of being surfaced in the search results. Here is a C# AddFixedPriceItem sample for listing an item with product identifier. Both UPC and MPN are passed in the request and eBay uses the first matching product to prefill the item listing.

This sample has been written using the .NET SDK v715

References:

Listing with Product Data

Finding ePID

Below is the code. Corresponding SOAP request is attached with this article.

AddFPItemCall.Item = item;
AddFPItemCall.Item = item;

/* 2012-2013 eBay Inc., All Rights Reserved */
/* Licensed under CDDL 1.0 - http://opensource.org/licenses/cddl1.php */

using eBay.Service.Call;
using eBay.Service.Core.Sdk;
using eBay.Service.Util;
using eBay.Service.Core.Soap;

namespace Trading_Samples
{
    public class AddFixedPriceItem
    {
       //AddFPItem - listing using ePID
        private void AddFPItemCatalog()
   {
                       
            //create the context
            ApiContext context = new ApiContext();

            //set the User token
            context.ApiCredential.eBayToken = "Your token";

            //set the server url
            context.SoapApiServerUrl = "https://api.sandbox.ebay.com/wsapi";

            //enable logging
            context.ApiLogManager = new ApiLogManager();
            context.ApiLogManager.ApiLoggerList.Add(new FileLogger("../../log.txt", true, true, true));
            context.ApiLogManager.EnableLogging = true;

            //set the version
            context.Version = "715";
            context.Site = SiteCodeType.Australia;

            string UPC = "753759090913"; //Garmin nuvi 1350 GPS
            string Brand = "Garmin";
            string MPN = "010-00782-20";

            //create the call object
            AddFixedPriceItemCall AddFPItemCall = new AddFixedPriceItemCall(context);

            AddFPItemCall.AutoSetItemUUID = true;

            //create an item object and set the properties
            ItemType item = new ItemType();

            //set the item condition depending on the value from GetCategoryFeatures
            item.ConditionID = 1000; //new

            //Basic properties of a listing
            item.Country = CountryCodeType.AU;
            item.Currency = CurrencyCodeType.AUD;

            //Track item by SKU
            item.InventoryTrackingMethod = InventoryTrackingMethodCodeType.SKU;
            item.SKU = "PROD1234";

            item.Description = "test - do not bid or buy";
            item.Title = "test - do not bid or buy";
            item.SubTitle = "Test Item";
            item.ListingDuration = "Days_7";

            item.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection();
            item.PaymentMethods.Add(BuyerPaymentMethodCodeType.PayPal);
            item.PayPalEmailAddress = "test@test.com";
            item.Location = "Australia";

            //Specify Shipping Services
            item.DispatchTimeMax = 3;
            item.ShippingDetails = new ShippingDetailsType();
            item.ShippingDetails.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection();

            ShippingServiceOptionsType shipservice1 = new ShippingServiceOptionsType();
            shipservice1.ShippingService = "AU_Regular";
            shipservice1.ShippingServicePriority = 1;
            shipservice1.ShippingServiceCost = new AmountType();
            shipservice1.ShippingServiceCost.currencyID = CurrencyCodeType.AUD;
            shipservice1.ShippingServiceCost.Value = 1.0;

            shipservice1.ShippingServiceAdditionalCost = new AmountType();
            shipservice1.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.AUD;
            shipservice1.ShippingServiceAdditionalCost.Value = 1.0;

            item.ShippingDetails.ShippingServiceOptions.Add(shipservice1);

            ShippingServiceOptionsType shipservice2 = new ShippingServiceOptionsType();
            shipservice2.ShippingService = "AU_Express";
            shipservice2.ShippingServicePriority = 2;
            shipservice2.ShippingServiceCost = new AmountType();
            shipservice2.ShippingServiceCost.currencyID = CurrencyCodeType.AUD;
            shipservice2.ShippingServiceCost.Value = 4.0;

            shipservice2.ShippingServiceAdditionalCost = new AmountType();
            shipservice2.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.AUD;
            shipservice2.ShippingServiceAdditionalCost.Value = 1.0;

            item.ShippingDetails.ShippingServiceOptions.Add(shipservice2);

            //Specify Return Policy
            item.ReturnPolicy = new ReturnPolicyType();
            item.ReturnPolicy.ReturnsAcceptedOption = "ReturnsAccepted";

            item.Quantity = 10;
            item.StartPrice = new AmountType();
            item.StartPrice.currencyID = CurrencyCodeType.AUD;
            item.StartPrice.Value = 10;

            item.PrimaryCategory = new CategoryType();
            item.PrimaryCategory.CategoryID = "156955";

            item.ProductListingDetails = new ProductListingDetailsType();

            //Specifying UPC as the product identifier. Other applicable product identifiers
            //include ISBN, EAN, Brand-MPN.

            item.ProductListingDetails.UPC = UPC;

            //If multiple product identifiers are specified, eBay uses the first one that
            //matches a product in eBay's catalog system.
            item.ProductListingDetails.BrandMPN = new BrandMPNType();
            item.ProductListingDetails.BrandMPN.Brand = Brand;
            item.ProductListingDetails.BrandMPN.MPN = MPN;

            //For listing to be pre-filled with product information from the catalog
            item.ProductListingDetails.IncludePrefilledItemInformation = true;

            //Include the eBay stock photo with the listing if available and use it as the gallery picture
            item.ProductListingDetails.IncludeStockPhotoURL = true;
            item.ProductListingDetails.UseStockPhotoURLAsGallery = true;
            item.ProductListingDetails.UseStockPhotoURLAsGallerySpecified = true;

            //If multiple prod matches found, list the item with the 1st product's information
            item.ProductListingDetails.UseFirstProduct = true;
            // List the item even if no product match found
            item.ProductListingDetails.ListIfNoProduct = true;

            //Add pictures
            item.PictureDetails = new PictureDetailsType();

            //Specify GalleryType
            item.PictureDetails.GalleryType = GalleryTypeCodeType.None;
            item.PictureDetails.GalleryTypeSpecified = true;

            AddFPItemCall.Item = item;

            //set the item and make the call
            AddFPItemCall.Execute();

            Console.WriteLine(AddFPItemCall.ApiResponse.Ack + " " + AddFPItemCall.ApiResponse.ItemID);

        }
   }

}

How well did this answer your question?