timotheus / ebaysdk-python

eBay API SDK for Python
https://developer.ebay.com/tools/sdks
Other
808 stars 326 forks source link

Problem with NamevalueList tag (AddFixedPriceItem) #327

Closed blob84 closed 4 years ago

blob84 commented 4 years ago

I am trying to insert a new item. This is the json I've generated:

{
    "Item": {
        "ConditionID": "1000",
        "Country": "IT",
        "Currency": "EUR",
        "DispatchTimeMax": "10",
        "ListingDuration": "GTC",
        "Location": "italy",
        "PostalCode": "123123",
        "PrimaryCategory": {
            "CategoryID": "139909"
        },
        "SellerProfiles": {
            "SellerPaymentProfile": {
                "PaymentProfileID": "93481782044",
                "PaymentProfileName": "PayPal"
            },
            "SellerReturnProfile": {
                "ReturnProfileID": "157042211014",
                "ReturnProfileName": "return"
            },
            "SellerShippingProfile": {
                "ShippingProfileID": "168037118014",
                "ShippingProfileName": "ship"
            }
        },
        "Storefront": {
            "StoreCategoryID": "6302634014",
            "StoreCategoryName": "Cat"
        },
        "VATDetails": {
            "VATPercent": "22"
        },
        "ItemSpecifics": {
           "NameValueList": [
                {
                    "name": "Materiale",
                    "value": [
                        "Altro materiale"
                    ]
                },
                {
                    "name": "Inserzione bundle",
                    "value": [
                        "No"
                    ]
                },
                {
                    "name": "Articolo modificato",
                    "value": [
                        "No"
                    ]
                },
                {
                    "name": "Marca",
                    "value": [
                        "silverline"
                    ]
                },
                {
                    "name": "MPN",
                    "value": [
                        "868593"
                    ]
                }
            ]
        },
        "ProductListingDetails": {
            "BrandMPN": {
                "Brand": "silverline",
                "MPN": "123456"
            }
        },
        "PictureDetails": {
            "PictureURL": [
                "https://www.domain.com/pub/media/catalog/product/8/6/868593.jpg",
                "https://www.domain.com/pub/media/catalog/product/8/6/868593_enwwmpro2.jpg",
                "https://www.domain.com/pub/media/catalog/product/8/6/868593_enwwmpro3.jpg",
                "https://www.domain.com/pub/media/catalog/product/8/6/868593_enwwmpro4.jpg"
            ]
        },
        "Description": "desc",
        "Title": "Product",
        "SKU": "123456",
        "StartPrice": "21.35",
        "Quantity": "2"
    }
}

I get the following error when I try to submit it: Error, Code: 20170, SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize..

Converting json to xml I can submit with postman. I suppose the NameValueList list is not correctly converted to the corresponding xml tag. It should be:

<NameValueList>
   <Name>a</Name>
   <Value>1</value>
</NameValueList>
.
.
.
<NameValueList>
   <Name>b</Name>
   <Value>2</value>
</NameValueList>
.

I am using python3.7.

blob84 commented 4 years ago

It was a problem with the description. I forgot the "<![CDATA[" in the description field.