4

In my application I would like add Brand and MPN to existing eBay item via API on C#, so, I run code:

        string eCommerceID = (dr["eCommerceID"] ?? "").ToString().Trim();
        string upc = (dr["UPC"] ?? "").ToString().Trim();
        string manufacturerName = (dr["ManufacturerName"] ?? "").ToString().Trim();
        string brandMPN = (dr["BrandMPN"] ?? "").ToString().Trim();

        ReviseItemRequestType reviseItemRequestType = new ReviseItemRequestType();
        reviseItemRequestType.Version = version;
        reviseItemRequestType.Item = new ItemType();
        reviseItemRequestType.Item.ItemID = eCommerceID;
        reviseItemRequestType.Item.ProductListingDetails = new ProductListingDetailsType();
        reviseItemRequestType.Item.ProductListingDetails.UPC = upc;

        reviseItemRequestType.Item.ProductListingDetails.BrandMPN = new BrandMPNType();
        reviseItemRequestType.Item.ProductListingDetails.BrandMPN.Brand = manufacturerName;
        reviseItemRequestType.Item.ProductListingDetails.BrandMPN.MPN = brandMPN;

        ReviseItemResponseType reviseItemResponseType = ebayService.ReviseItem(reviseItemRequestType);

but when I execute this code, eBay returns error:

"The item specific Brand is missing. Add Brand to this listing, enter a valid value, and then try again."

What I'm doing wrong?

Appreciate any help. Thanks.

enter image description here

Error: enter image description here

ihorko
  • 6,855
  • 25
  • 77
  • 116

2 Answers2

6

As the error messages says:

The item specific Brand is missing

Don't use the Item.ProductListingDetails.BrandMPN in your request. Instead you will need to create two Item Specifics called Band and MPN.

<ItemSpecifics>
    <NameValueList>
        <Name>Brand</Name>
        <Value>[BRAND VALUE]</Value>
    </NameValueList>
    <NameValueList>
        <Name>MPN</Name>
       <Value>[MPN VALUE]</Value>
    </NameValueList>
</ItemSpecifics>
4

Here is copy paste code snippet of the C# solution.

ItemType itemType = new ItemType();   // = class eBay.Service.Core.Soap.ItemType
Int32 condCodeAsInt = 1000; // upto you to derrive this from your use case.
String myBrandValue = "Some BRAND";
String myMpnValue = "some MPN"; 
String myUpcValue = "Does not apply";

....

//if condition is "New" or "New with Details" then we need to set extra REQUIRED fields

            if (condCodeAsInt == 1000 || condCodeAsInt == 1500)
            {

                //if it is "new" then remove inputted desc text completely REQUIRED
                if (condCodeAsInt == 1000)
                {
                    itemType.ConditionDescription = "";
                }

                // set UPC value HERE, not in ItemSpecifics. 
                ProductListingDetailsType pldt =  new ProductListingDetailsType();
                pldt.UPC = myUpcValue;

                itemType.ProductListingDetails = pldt;

                //init Item specifics ( and set BRAND and MPN )
                itemType.ItemSpecifics = new NameValueListTypeCollection();

                //brand
                NameValueListType nvBrand = new NameValueListType();
                nvBrand.Name = "Brand";
                StringCollection brandStringCol = new StringCollection();
                brandStringCol.Add(myBrandValue);
                nvBrand.Value = brandStringCol;

                itemType.ItemSpecifics.Add(nvBrand);

                //MPN
                NameValueListType nvMpn = new NameValueListType();
                nvMpn.Name = "MPN";
                StringCollection mpnStringCol = new StringCollection();
                mpnStringCol.Add(myMpnValue);
                nvMpn.Value = mpnStringCol;

                itemType.ItemSpecifics.Add(nvMpn);

            }
Selwyn
  • 3,118
  • 1
  • 26
  • 33