Skip to main content
Published: September 22 2010, 10:20:00 AMUpdated: November 28 2020, 8:58:54 PM

If you list an item with product data, your item has better chances of being surfaced in the search results. Here is a VB.NET AddFixedPriceItem sample for listing an item with product identifier. Both UPC and MPN are in the code, but the MPN is commented out as you don't need to pass in both.  UPC IS 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 v817

References:

Listing with Product Data

Finding ePID

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



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

        'create the context
        Dim context As New ApiContext()

        'set the User token
        context.ApiCredential.eBayToken = "Your token  here"

        'set the server url. Pointing to Sandbox
        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 = "817"
        context.Site = SiteCodeType.UK

        Dim UPC As String = "753759090913"
        'Garmin nuvi 1350 GPS
        'Dim Brand As String = "Garmin"
        'Dim MPN As String = "010-00782-20"

        'create the call object
        Dim AddFPItemCall As New AddFixedPriceItemCall(context)

        AddFPItemCall.AutoSetItemUUID = True

        'create an item object and set the properties
        Dim item As New ItemType()

        'set the item condition depending on the value from GetCategoryFeatures
        item.ConditionID = 1000
        'new
        'Basic properties of a listing
        item.Country = CountryCodeType.GB
        item.Currency = CurrencyCodeType.GBP

        '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.PostalCode = "SE6 1AL"

        'Specify Shipping Services
        item.DispatchTimeMax = 3
        item.ShippingDetails = New ShippingDetailsType()
        item.ShippingDetails.ShippingServiceOptions = New ShippingServiceOptionsTypeCollection()

        Dim shipservice1 As New ShippingServiceOptionsType()
        shipservice1.ShippingService = "UK_SellersStandardRate"
        shipservice1.ShippingServicePriority = 1
        shipservice1.ShippingServiceCost = New AmountType()
        shipservice1.ShippingServiceCost.currencyID = CurrencyCodeType.GBP
        shipservice1.ShippingServiceCost.Value = 1.0

        shipservice1.ShippingServiceAdditionalCost = New AmountType()
        shipservice1.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.GBP
        shipservice1.ShippingServiceAdditionalCost.Value = 1.0

        item.ShippingDetails.ShippingServiceOptions.Add(shipservice1)

        Dim shipservice2 As New ShippingServiceOptionsType()
        shipservice2.ShippingService = "UK_RoyalMailFirstClassStandard"
        shipservice2.ShippingServicePriority = 2
        shipservice2.ShippingServiceCost = New AmountType()
        shipservice2.ShippingServiceCost.currencyID = CurrencyCodeType.GBP
        shipservice2.ShippingServiceCost.Value = 4.0

        shipservice2.ShippingServiceAdditionalCost = New AmountType()
        shipservice2.ShippingServiceAdditionalCost.currencyID = CurrencyCodeType.GBP
        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.GBP
        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.Gallery
        item.PictureDetails.GalleryTypeSpecified = True

        AddFPItemCall.Item = item

        'set the item and make the call
        AddFPItemCall.Execute()Console.WriteLine(AddFPItemCall.ApiResponse.Ack + " " + AddFPItemCall.ApiResponse.ItemID)

End Sub End Class End Namespace

Attachments
How well did this answer your question?
Answers others found helpful