question

mrkmrk673 avatar image
0 Likes"
mrkmrk673 asked

Schema XML error sending API call to eBay - "invalid element"

I am having issues sending this eBay API call (the Trading API for AddItem), as it returns error code 20170 (Schema XML request error for invalid element) back to me. The code:

from ebaysdk.trading import Connection

if __name__ == '__main__':
    api = Connection(config_file="ebay.yaml", domain="api.sandbox.ebay.com", debug=True)
    request = {
        "Item": {
            "Title": "Professional Mechanical Keyboard",
            "Country": "US",
            "Location": "IT",
            "Site": "US",
            "ConditionID": "1000",
            "ItemSpecifics": {
                 "Brand": "Microsoft",
                 "Type": "n/a"
            },
            "PrimaryCategory": {"CategoryID": "33963"},
            "Description": "A really nice mechanical keyboard!",
            "ListingDuration": "Days_10",
            "StartPrice": "150",
            "Currency": "USD",
            "ReturnPolicy": {
                "ReturnsAcceptedOption": "ReturnsAccepted",
                "RefundOption": "MoneyBack",
                "ReturnsWithinOption": "Days_30",
                "ShippingCostPaidByOption": "Buyer"
            },
            "ShippingDetails": {
                "ShippingServiceOptions": {
                    "FreeShipping": "True",
                    "ShippingService": "USPSMedia"
                }
            },
            "DispatchTimeMax": "3"
        }
    }

    api.execute("AddItem", request)

In particular, I am referring to the dict for ItemSpecifics: for ‘Brand’ and ‘Type’, it claims a Schema XML request error: Invalid element. Eg here:

        "ItemSpecifics": {
             "Brand": "Microsoft",
             "Type": "n/a"
        },

Everything else works fine, and despite my best efforts to try different things I cannot get this to work. These fields unfortunately are required for this API call so I must figure out the fix.

additemjsonebay trading apiebaysdk-pythonxml-schema
10 |600

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.