Details
-
Bug
-
Resolution: Unresolved
-
High
-
None
-
2013.11
-
None
Description
While trying to create some content, an InvalidArgumentType exception is being raise, apparently, without proper reason.
Steps to reproduce:
- Create a class with a text line field
- Create content, through REST api v2, using RESTClient (for instance). Use the following XML
POST: http://ez2013-11.io-solinf.pt/api/ezp/v2/content/objects
<?xml version="1.0" encoding="UTF-8"?> <ContentCreate> <ContentType href="/api/ezp/v2/content/types/40" /> <mainLanguageCode>eng-GB</mainLanguageCode> <LocationCreate> <ParentLocation href="/api/ezp/v2/content/locations/1/2/111" /> <priority>0</priority> <hidden>false</hidden> <sortField>PATH</sortField> <sortOrder>ASC</sortOrder> </LocationCreate> <Section href="/api/ezp/v2/content/sections/1" /> <alwaysAvailable>true</alwaysAvailable> <User href="/api/ezp/v2/user/users/14" /> <modificationDate>2012-09-30T12:30:00</modificationDate> <fields> <field> <fieldDefinitionIdentifier>title</fieldDefinitionIdentifier> <languageCode>eng-GB</languageCode> <fieldValue>1234</fieldValue> </field> </fields> </ContentCreate>
The following error will be thrown
<errorMessage>Not Acceptable</errorMessage> <errorDescription>Argument '$value->text' is invalid: expected value to be of type 'string', got 'integer'</errorDescription>
Encapsulating all string fields in CDATA blocks seems overkill to me. Is there a simple way to format the XML so that 1234 is parsed (or accepted) as a valid string instead of as an integer?