cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Ebay API - Passing HTML Template Code To Description in VerifyAddItem/AddItem - Error Code 20170

I am struggling to pass an HTML template into my Description tag for VerifyAddItem. Here is the error message I'm working with:
ebaysdk [ERROR]:VerifyAddItem: 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..

There is little documentation on how to accomplish this. Following the official AddItem docs, I've tried wrapping my raw html text in "<![CDATA[" + description_html_string + "]]". Doing this gives me a different error:

ebaysdk [ERROR]:VerifyAddItem: Class: RequestError, Severity: Error, Code: 5, XML Parse error. XML Error Text: "; nestedexception is: org.xml.sax.SAXParseException: XML document structures must start and end within the same entity.".

I'm using JSON to construct my payload for the API call, so I'm not even sure if I need to do above^. I know my payload works fine. Simply replacing my description with plain text like below works, i.e. the VerifyAddItem API call succeeds:

"Item"{
 ...
     "Description" : "boring non html template description :("
...
}

Setting the Description tag with a far more simple html snippet like this: "<p> asdfasdfasd asdfasdf </p>" Also yields the same exact error.

 

I know my python code returns valid html because I've ran the HTML on my browser and it looks great. Furthermore, it does not exceed the max number of characters as specified in the docs. I've tried following this page already and their suggestions didn't work. This leads me to believe that this is not an issue with my HTML, however one with how i'm interacting with the API.

 

I'm a beginner when it comes to XML. Has anyone encountered these issues and can help? I at least would like more context with respect to the error I have. The returned errors aren't super clear to me. I would like the answers to be more tailored to the eBay SDK/ Trading API if possible, am I missing a tag in my payload or something?

Message 1 of 4
latest reply
1 BEST ANSWER

Accepted Solutions

Ebay API - Passing HTML Template Code To Description in VerifyAddItem/AddItem - Error Code 20170

@right_variety 

 

I have no XML experience, but I would suggest looking at those brackets.  This page explains how cdata can be used in XML documents, and the limitations:

 

https://www.novixys.com/blog/what-characters-need-to-be-escaped-in-xml-documents/

 

Since you are using JSON to pass data into an XML structure, it would seem that this JSON embedded data could work with XML:

"Item"{
 ...
     "Description" : "<![CDATA[[<p>Hello world.</p>]]>"
...
}

 

 

ShipScript has been an eBay Community volunteer since 2003, specializing in HTML, CSS, Scripts, Photos, Active Content, Technical Solutions, and online Seller Tools.

View Best Answer in original post

Message 2 of 4
latest reply
3 REPLIES 3

Ebay API - Passing HTML Template Code To Description in VerifyAddItem/AddItem - Error Code 20170

@right_variety 

 

I have no XML experience, but I would suggest looking at those brackets.  This page explains how cdata can be used in XML documents, and the limitations:

 

https://www.novixys.com/blog/what-characters-need-to-be-escaped-in-xml-documents/

 

Since you are using JSON to pass data into an XML structure, it would seem that this JSON embedded data could work with XML:

"Item"{
 ...
     "Description" : "<![CDATA[[<p>Hello world.</p>]]>"
...
}

 

 

ShipScript has been an eBay Community volunteer since 2003, specializing in HTML, CSS, Scripts, Photos, Active Content, Technical Solutions, and online Seller Tools.
Message 2 of 4
latest reply

Ebay API - Passing HTML Template Code To Description in VerifyAddItem/AddItem - Error Code 20170

Found my issue... I had a typo in my CDATA wrapper, I was missing the closing carrot ">" 🙄

 

Passing my html code the way you outlined works, thanks for the reply.

 

As an aside, the post you linked was very helpful with escaping those pesky ampersands! 

Message 3 of 4
latest reply

Ebay API - Passing HTML Template Code To Description in VerifyAddItem/AddItem - Error Code 20170

Glad it helped. Thanks for posting your solution. 🙂

ShipScript has been an eBay Community volunteer since 2003, specializing in HTML, CSS, Scripts, Photos, Active Content, Technical Solutions, and online Seller Tools.
Message 4 of 4
latest reply