2

I'm trying to build an AddItem function for python with the ebaysdk and am having a few problems getting things to work properly.

Here is my python code that I'm calling:

def addItem(opts):

    try:
        api = Trading(domain=opts.domain, debug=opts.debug, config_file=opts.yaml, appid=opts.appid,
                      certid=opts.certid, devid=opts.devid, warnings=False)

        myitem = {
            "Item": {
                "Title": "Martin Landau AUTOGRAPH - 2016 Leaf POP Century",
                "Description": "You are bidding on an autographed Martin Landau card from 2016 Lead POP Century!",
                "PrimaryCategory": {"CategoryID": "183050"},
                "StartPrice": ".99",
                "CategoryMappingAllowed": "true",
                "Country": "US",
                "ConditionID": "3000",
                "Currency": "USD",
                "DispatchTimeMax": "3",
                "ListingDuration": "Days_7",
                "ListingType": "Chinese",
                "PaymentMethods": "PayPal",
                "PayPalEmailAddress": "email@here",
                "PictureDetails": {
            "GalleryType": "Gallery",
            "PictureURL": [
            "https://i.ebayimg.com/xxxxxxxxx/$_1.JPG?set_id=2",
                    "https://i.ebayimg.com/xxxxxxxxxx/$_1.JPG?set_id=2"
                    ],
            "GalleryURL": "https://i.ebayimg.com/xxxxxxxx/$_1.JPG?set_id=2"
                },
                "PostalCode": "34638",
                "Quantity": "1",
                "ReturnPolicy": {
                    "ReturnsAcceptedOption": "ReturnsNotAccepted"
                },
            "ShippingDetails": {
                    "ShippingDiscountProfileID": "0",
                    "InternationalShippingDiscountProfileID": "0",
                    "ShippingServiceOptions": {
                        "ShippingServicePriority": "1",
                        "ShippingTimeMin": "2",
                        "ExpeditedService": "false",
                        "ShippingService": "USPSFirstClass",
                        "ShippingTimeMax": "3"
                    },
                    "GlobalShipping": "true",
                    "CalculatedShippingRate": {
                        "ShippingIrregular": "false",
                        "PackagingHandlingCosts": {
                            "_currencyID": "USD",
                            "value": "0.0"
                        },
                        "PackageDepth": {
                            "_unit": "inches",
                            "_measurementSystem": "English",
                            "value": "1"
                        },
                        "WeightMajor": {
                            "_unit": "lbs",
                            "_measurementSystem": "English",
                            "value": "1"
                        },
                        "WeightMinor": {
                            "_unit": "oz",
                            "_measurementSystem": "English",
                            "value": "0"
                        },
                        "ShippingPackage": "PackageThickEnvelope",
                        "OriginatingPostalCode": "34638",
                        "PackageWidth": {
                            "_unit": "inches",
                            "_measurementSystem": "English",
                            "value": "5"
                         },
                        "PackageLength": {
                            "_unit": "inches",
                            "_measurementSystem": "English",
                            "value": "8"
                        },
                        "InternationalPackagingHandlingCosts": {
                            "_currencyID": "USD",
                            "value": "0.0"
                        }
            }
                },
                "Site": "US"
            }
        }

        api.execute('AddItem', myitem)
        dump(api)

    except ConnectionError as e:
        print(e)
        print(e.response.dict())

When I try to run I get this error:

u'AddItem: Class: RequestError, Severity: Error, Code: 20170, Schema XML request error. Schema XML request error: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize..'
{'Ack': 'Failure', 'Timestamp': '2018-07-21T04:12:36.891Z', 'Errors': {'SeverityCode': 'Error', 'ErrorClassification': 'RequestError', 'ErrorCode': '20170', 'LongMessage': 'Schema XML request error: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize..', 'ErrorParameters': {'_ParamID': '0', 'Value': 'SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.'}, 'ShortMessage': 'Schema XML request error.'}, 'Version': '1069', 'Build': 'E1069_UNI_API5_18749601_R1'}

From what I've read this sounds like probably a syntax error in my code somewhere, but I can't find any issues. Are there any programs or utilities I can execute in order to find possible syntax issues?

pushkin
  • 9,575
  • 15
  • 51
  • 95
user3299633
  • 2,971
  • 3
  • 24
  • 38
  • There are lots of coding programs, editors, IDEs, etc. to help find syntax issues -- the best place to ask about those is probably [Software Recommendations Stack Exchange](https://softwarerecs.stackexchange.com). – jkdev Jul 22 '18 at 05:14
  • You should probably validate your JSON payload against Ebay's schema to see if you are doing it right. – Cheesebaron Jul 22 '18 at 11:32
  • @Cheesebaron Where could one locate such schemas? – rom Dec 01 '21 at 18:28
  • Recent stuff is here: https://developer.ebay.com/api-docs/buy/order/static/overview.html not sure what you are looking for @rom – Cheesebaron Dec 01 '21 at 22:17

0 Answers0