Sample code for listing a FixedPriceItem with ebay
Asked Answered
N

2

15

I'm working with Python 2.7 on a Linux environment, my app working with the ebay trading API with the sdk: ebaysdk-python. My goal is to list a fixedpriceitem, I didn't found a correct way to do it...

It seems the example on the ebay website for the developer isn't working also.

this is what i try :

def AddFixedPriceItem(log,country):

try:
    try:
        t = Connection(config_file='ebay.yaml',debug=True)
    except Exception:
        t = Connection(config_file='../ebay.yaml',debug=True)

    myitem = {
        'ErrorLanguage': 'en_US',
        'WarningLevel': 'High',
        'Item': {
            'PayPalEmailAddress': '[email protected]',
            'ShipToLocations': 'IT',
            'ReservePrice': '0.0',
            'Title': 'TEST AUCTION 1',
            'Description': 'TEST AuCTION 1',
            'ProxyItem': 'false',
            'HitCounter': 'NoHitCounter',
            'BuyerRequirementDetails': {
                'ShipToRegistrationCountry': 'true'
            },
            'Location': 'Lombardia',
            'ReturnPolicy': {
                'ReturnsWithin': '30 giorni',
                'Description': 'Puoi rendere il prodotto che non ti soddisfa entro e non oltre 30 giorni di calendario dalla data di consegna. Ti invitiamo a provare i prodotti senza rimuovere i cartellini e i sigilli oppure rompere la confezione poichè non potranno essere resi articoli che non siano nelle stesse condizioni in cui li hai ricevuti.\n\nVerranno rimborsati solo ed esclusivamente i prodotti effettivamente ricevuti dal magazzino. Nel caso in cui non venissero rispettate le condizioni appena descritte ed eventualmente accertato il difetto, ti informiamo che il pacco reso ti verrà restituito e il rimborso non verrà accreditato.\n\nPer tutte le richieste di autorizzazione al reso pervenute al nostro Servizio Clienti, il reso è gratuito. Nel caso in cui il pacco venga restituito al magazzino senza autorizzazione al reso e senza il tracking da noi fornito, non sarà effettuato alcun rimborso per le spese di reso sostenute.',
                'ShippingCostPaidBy': 'Buyer',
                'ReturnsWithinOption': 'Days_30',
                'ShippingCostPaidByOption': 'Buyer',
                'ReturnsAcceptedOption': 'ReturnsAccepted',
            },
            'BusinessSellerDetails': {
                'LegalInvoice': 'true',
                'Fax': '0',
                'Address': {
                    'FirstName': 'xxx',
                    'CompanyName': 'xxxxxxxxx',
                    'Street1': 'Via delle xxx 26',
                    'CityName': 'xxx della riviera',
                    'CountryName': 'Italia',
                    'Phone': '. .',
                    'LastName': 'xxx',
                    'PostalCode': '25080',
                    'StateOrProvince': 'MI'
                },
                'Email': '[email protected]',
                'VATDetails': {
                    'VATSite': 'IT',
                    'VATID': '0976543233'
                }
            },
            'ListingDuration': 'GTC',
            'PictureDetails': {
                'GalleryType': 'Plus',
                'PhotoDisplay': 'SuperSize',
                'ExternalPictureURL': 'http://ecx.images-amazon.com/images/I/41xZFac6ZsL.jpg'
            },
            'BuyerProtection': 'ItemEligible',
            'StartPrice': '28.99',
            'eBayPlusEligible': 'false',
            'BuyItNowPrice': '0.0',
            'PrimaryCategory': { 'CategoryID': '324' },
            'GetItFast': 'false',
            'ListingType': 'FixedPriceItem',
            'Country': 'IT',
            'HideFromSearch': 'true',
            'ConditionID': '1000',
            'PaymentMethods': 'PayPal',
            #'SecondaryCategory': { 'CategoryID': '324' },
            'AutoPay': 'true',
            'OutOfStockControl': 'true',
            'ReasonHideFromSearch': 'OutOfStock',
            'Quantity': '1',
            'eBayPlus': 'false',
            'DispatchTimeMax': '3',
            'GiftIcon': '0',
            'PostCheckoutExperienceEnabled': 'false',
            'Site': 'Italy',
            'BuyerGuaranteePrice': '20000.0',
            'Currency': 'EUR',
            'HitCount': '8',
            'ConditionDisplayName': 'Nuovo',
            'PrivateListing': 'false',
            'ShippingPackageDetails': {
                'ShippingIrregular': 'false',
                'ShippingPackage': 'None',
                'WeightMajor': '0',
                'WeightMinor': '0'
            },
            'ShippingDetails': {
                'InsuranceFee': '5.0',
                'InternationalShippingDiscountProfileID': '0',
                'ShippingServiceOptions': {
                    'ShippingTimeMax': '2',
                    'ShippingServiceCost': '0.0',
                    'ShippingServicePriority': '1',
                    'ShippingService': 'IT_ExpressCourier',
                    'ExpeditedService': 'true',
                    'ShippingTimeMin': '1'
                },
                'InsuranceDetails': {
                    'InsuranceFee': '5.0',
                    'InsuranceOption': 'Optional'
                },
                'InsuranceOption': 'Optional',
                'ShippingDiscountProfileID': '0',
                'CalculatedShippingRate': {
                    'WeightMinor': '0',
                    'WeightMajor': '0'
                },
                'SellerExcludeShipToLocationsPreference': 'true',
                'ShippingType': 'Flat',
                'SalesTax': {
                    'SalesTaxPercent': '0.0',
                    'ShippingIncludedInTax': 'false'
                },
                'ApplyShippingDiscount': 'false',
                'ThirdPartyCheckout': 'false'
            }
        }
    }

    t.execute('AddFixedPriceItem', myitem)
    #print t.response.dict()
    print t.response.content

except Exception as e:
    pass

This is the error :

2016-07-03 09:20:19,763 ebaysdk [ERROR]:AddFixedPriceItem: Class: RequestError, Severity: Error, Code: 21919303, Manca la specifica delloggetto relativa a {0}. Manca la specifica delloggetto relativa a {0}. Aggiungi {0\} a questa inserzione, inserisci un valore valido e riprova., Class: RequestError, Severity: Error, Code: 21919301, Immetti un valore in \ {0 \} e riprova. In EAN manca un valore. Immetti un valore e riprova.

it looks like they want a EAN field but if i try to put in the json :

...
    'ProductListingDetails':{
                'BrandMPN':{
                    'Brand' : 'TEST BRAND',
                    'MPN' : 'U4162G04311_BLACKC9997'
                },
                'EAN': '8054241786423'
            },
 ...

 ...
    'ReturnPolicy': {
                'ReturnsWithin': '30 giorni',
                'Description': 'Puoi rendere il prodotto che non ti soddisfa entro e non oltre 30 giorni di calendario dalla data di consegna. Ti invitiamo a provare i prodotti senza rimuovere i cartellini e i sigilli oppure rompere la confezione poichè non potranno essere resi articoli che non siano nelle stesse condizioni in cui li hai ricevuti.\n\nVerranno rimborsati solo ed esclusivamente i prodotti effettivamente ricevuti dal magazzino. Nel caso in cui non venissero rispettate le condizioni appena descritte ed eventualmente accertato il difetto, ti informiamo che il pacco reso ti verrà restituito e il rimborso non verrà accreditato.\n\nPer tutte le richieste di autorizzazione al reso pervenute al nostro Servizio Clienti, il reso è gratuito. Nel caso in cui il pacco venga restituito al magazzino senza autorizzazione al reso e senza il tracking da noi fornito, non sarà effettuato alcun rimborso per le spese di reso sostenute.',
                'ShippingCostPaidBy': 'Buyer',
                'EAN': '8054241786423',
                'ReturnsWithinOption': 'Days_30',
                'ShippingCostPaidByOption': 'Buyer',
                'ReturnsAcceptedOption': 'ReturnsAccepted',
            },

Ebay answer with a generic error :

2016-07-03 09:28:26,325 ebaysdk [ERROR]:AddFixedPriceItem: Class: RequestError, Severity: Error, Code: 21919303, Manca la specifica delloggetto relativa a {0}. Manca la specifica delloggetto relativa a {0}. Aggiungi {0\} a questa inserzione, inserisci un valore valido e riprova.

Someone out there can post a full working code written in Python, to publish a fixedpriceitem with the ebaysdk-Python API?

UPDATE :

Based on the answer below i try to include items specifics but the error is still the same, i try also to use the example provided but the error is still the same :

myitem = {
            "Item": {
            'Title': 'Apple MacBook Pro MB990LL/A 13.3 in. Notebook NEW',
            'Description': 'Brand New Apple MacBook Pro MB990LL/A 13.3 in. Notebook!',
            'PrimaryCategory': {'CategoryID' : 111422},
            'StartPrice':3200.0,
            'CategoryMappingAllowed': 'true',
            'ConditionID':1000,

            'Country':'IT',
            'Currency':'EUR',
            'DispatchTimeMax':3,
            'ListingDuration':'Days_7',
            'ListingType':'FixedPriceItem',
            'PaymentMethods':'PayPal',
            'PayPalEmailAddress':'[email protected]',

                'PictureDetails': {
                    'GalleryType': 'Plus',
                    'PhotoDisplay': 'SuperSize',
                    'ExternalPictureURL': 'http://yolo.com/images/I/41xZFac6ZsL.jpg'
                },

                "ItemSpecifics": {
                    "NameValueList": [
                        {"Name": "manufacturer",
                         "Value": info_container["manufacturer"]},
                        {"Name": "manufacturer number",
                         "Value": info_container["manufacturer_part_number"]}]},

            'PostalCode':95125,

            'ProductListingDetails': {
                'BrandMPN': {
                    'Brand': 'TEST BRAND',
                    'MPN': 'U4162G04311_BLACKC9997'
                },
                'EAN': '8054241786423',
                'UPC':885909298594,
                'IncludeStockPhotoURL':'true',
                'IncludeeBayProductDetails':'true',
                'UseFirstProduct':'true',
                'UseStockPhotoURLAsGallery':'true',
                'ReturnSearchResultOnDuplicates':'true'
            },
            'Quantity':6,
            'ReturnPolicy' :{
              'ReturnsAcceptedOption':'ReturnsAccepted',
              'RefundOption':'MoneyBack',
              'ReturnsWithinOption':'Days_30',
              'Description':'If you are not satisfied, return the item for refund.',
              'ShippingCostPaidByOption':'Buyer'
            },
            'ShippingDetails':{
              'ShippingType':'Flat',
              'ShippingServiceOptions':{
                'ShippingServicePriority':1,
                'ShippingService':'IT_ExpressCourier',
                'FreeShipping':'true',
                'ShippingServiceAdditionalCost':0.00
              }
            },
            'Site':'Italy'
        }
    }

ERROR :

2016-07-08 10:46:09,030 ebaysdk [ERROR]:AddFixedPriceItem: Class: RequestError, Severity: Error, Code: 21919303, Manca la specifica delloggetto relativa a {0}. Manca la specifica delloggetto relativa a {0}. Aggiungi {0\} a questa inserzione, inserisci un valore valido e riprova., Class: RequestError, Severity: Error, Code: 21919303, Manca la specifica delloggetto relativa a {0}. Manca la specifica delloggetto relativa a {0}. Aggiungi {0\} a questa inserzione, inserisci un valore valido e riprova.

UPDATE 11-07-2016 :

Unfortunately my bounty (50 points) is ended and not awarded to anyone because there isn't a good answer yet ... at this time i can't do a bounty again because i don't have enough points (to bounty) unfortunately.

I purchase 1 hour on the ebay Premium support (75$ 1 hour ...) , so i will update my question when they will answer ... and i hope to solve the problem ... This question takes many upvote , i am proud of it.

Thanks for your support.

Northnorthwest answered 30/6, 2016 at 13:32 Comment(5)
Please post what you tried, and what didn't work about it. This isn't really a place to come and ask people to write projects for you.Ionian
hi , this a second post of this problem, the first post i open have the code and NOBODY answer , just DOWNVOTE same here ... i don't understand why the people like to downvote, my project do a lot more than just listing , i don't want people write projects for me , in internet i was unable to find someone use the api for listing ... so it will be good for the community if someone write a complete working code for listing an item on ebay with python. i update my question, please remove your downvote.Northnorthwest
Your revision certainly helped so I'll remove my downvote, but please try to take note of the difference. In the first version (and presumably in your first post too) it got downvoted because you simply wrote "I can't do this, someone do it all for me." It's as simple as that, no one was out to get you or just likes downvoting - it does nothing for anyone to downvote other's questions. In your current post you listed code you tried, the resulting error, and what you think might be wrong.Ionian
Where is the link to the example in the docs?Reconnaissance
unfortunately there isn't any link to the python api in the ebay documentation , and the ebay error is so general ... I think ebay doesn't print the True error , because as you can see in the answer when Ebay need to say what field is wrong they put {0} instead of the name of the field. but this can be also a problem of the SDK .Northnorthwest
N
3

finally ebay answer to the question and solve the problem.

The call was failing because the mandatory ItemSpecifics Brand(Marca for Italy site) & MPN was missing. It'll work fine if you use the following parameters.

<ItemSpecifics>
  <NameValueList> 
    <Name>Marca</Name>
    <Value>TEST</Value>
  </NameValueList>
  <NameValueList>
    <Name>MPN</Name>
    <Value>00000</Value>
  </NameValueList>
</ItemSpecifics> 

The problem was about the name of the variable , for the italian site the name of the variable "Brand" is "Marca" ...

so for python dictionary in the request:

"ItemSpecifics": {
                    "NameValueList": [
                        {"Name": "Marca",
                         "Value": "TEST"},
                        {"Name": "MPN",
                         "Value": "0000"}
                    ]
                  }

The ebay support team at the moment doesn't have an expert in python but if you can provide the xml for the request they can help. To obtain the real XML with a python sdk you can include in the connection debug = true, example below:

t = Connection(config_file='ebay.yaml',debug=False)

Thanks to everybody for the support.

Northnorthwest answered 11/7, 2016 at 12:38 Comment(2)
thanks for the persistance and for positing this solutionToastmaster
by the i'm stuck with the EAN. Where do you put the EAN ?Toastmaster
I
0

The dictionary being used in the request should be as such. For example, if the Brand if Nike and the MPN is Shoe32

 {"Item":
      "ItemSpecifics": {
                "NameValueList": [
                    {"Name": "Brand",
                     "Value": "Nike"},
                    {"Name": "MPN",
                     "Value": "Shoe32"}]
       }
  }
Inscrutable answered 2/12, 2019 at 14:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.