Details
-
Bug
-
Resolution: Fixed
-
High
-
5.0.0-dev
-
None
-
rhel, mysql
Description
Given that I sent the request in the correct way ( no documentation for ezbinaryfile in REST is available AFAIK ) it is not possible to publish objects containing ezbinaryfile contenttype fields.
How to create the contenttype ( seems to work fine )
#################### - Client request BEGIN - ######################### POST /api/ezp/v2/content/typegroups/1/types?publish=true HTTP/1.1 Host: ezpublish5.rhel61.qa.ez.local:8080 User-Agent: eZ REST QA Tester Content-Length: 2224 Authorization: Basic YWRtaW46cHVibGlzaA== Accept: application/vnd.ez.api.ContentType+json Content-type: application/vnd.ez.api.ContentTypeCreate+json { "ContentTypeCreate": { "identifier": "TContentType", "mainLanguageCode": "eng-GB", "urlAliasSchema": "<name>", "nameSchema": "<name>", "isContainer": "true", "defaultSortField": "PATH", "defaultSortOrder": "ASC", "defaultAlwaysAvailable": "true", "names": { "value": [ { "_languageCode": "eng-GB", "#text": "RESTv2DatatypeTest" } ] }, "descriptions": { "value": [ { "_languageCode": "eng-GB", "#text": "This is a description" } ] }, "FieldDefinitions": { "FieldDefinition": [ { "identifier": "name", "fieldType": "ezstring", "names": { "value": [ { "_languageCode": "eng-GB", "#text": "Name" } ] }, "descriptions": { "value": [ { "_languageCode": "eng-GB", "#text": "This is the name" } ] }, "fieldGroup": "content", "position": "1", "isTranslatable": "true", "isRequired": "true", "isInfoCollector": "false", "isSearchable": "true", "defaultValue": "New Name" } , { "identifier": "file", "fieldType": "ezbinaryfile", "names": { "value": [ { "_languageCode": "eng-GB", "#text": "File" } ] }, "descriptions": { "value": [ { "_languageCode": "eng-GB", "#text": "This is a ezfile test" } ] }, "fieldGroup": "content", "position": "2", "isTranslatable": "true", "isRequired": "false", "isInfoCollector": "false", "isSearchable": "true" } ] } } }
How I try to create the object ( fails )
#################### - Client request BEGIN - ######################### POST /api/ezp/v2/content/objects HTTP/1.1 Host: ezpublish5.rhel61.qa.ez.local:8080 User-Agent: eZ REST QA Tester Content-Length: 914 Authorization: Basic YWRtaW46cHVibGlzaA== Accept: application/vnd.ez.api.Content+json Content-type: application/vnd.ez.api.ContentCreate+json { "ContentCreate": { "ContentType": { "_href": "/content/types/48" }, "mainLanguageCode": "eng-GB", "LocationCreate": { "ParentLocation": { "_href": "/content/locations/1/2" }, "priority": "0", "hidden": "false", "sortField": "PATH", "sortOrder": "ASC" }, "Section": { "_href": "/content/sections/1" }, "alwaysAvailable": "true", "User": { "_href": "/user/users/14" }, "modificationDate": "2012-09-30T12:30:00", "fields": { "field": [ { "fieldDefinitionIdentifier": "name", "languageCode": "eng-GB", "fieldValue": "testObject1" },{ "fieldDefinitionIdentifier": "file", "languageCode": "eng-GB", "fieldValue": "testfile.txt" "data": "VGhpcyBpcyB2ZXJzaW9uIDEgb2YgdGhlIGZpbGUKeWVz" } ] } } } ##################### - Client request END - ##########################
The result I get back is:
##################### - Target reply BEGIN - ########################## HTTP/1.1 500 Internal Server Error Date: Mon, 15 Apr 2013 11:11:53 GMT Server: Apache/2.2.15 (Red Hat) X-Powered-By: PHP/5.3.3 Status: 500 Internal Server Error Cache-Control: no-cache X-Debug-Token: 516be0797eead Connection: close Transfer-Encoding: chunked Content-Type: application/vnd.ez.api.ErrorMessage+json 93f {"ErrorMessage":{"_media-type":"application\/vnd.ez.api.ErrorMessage+json","errorCode":500,"errorMessage":"Internal Server Error","errorDescription":"Missing or invalid 'LocationCreate' element for ContentCreate.","trace":"#0 \/var\/www\/apache2php53\/ezpublish5\/vendor\/ezsystems\/ezpublish-kernel\/eZ\/Publish\/Core\/REST\/Common\/Input\/ParsingDispatcher.php(79): eZ\\Publish\\Core\\REST\\Server\\Input\\Parser\\ContentCreate->parse(NULL, Object(eZ\\Publish\\Core\\REST\\Common\\Input\\ParsingDispatcher))\n#1 \/var\/www\/apache2php53\/ezpublish5\/vendor\/ezsystems\/ezpublish-kernel\/eZ\/Publish\/Core\/REST\/Common\/Input\/Dispatcher.php(112): eZ\\Publish\\Core\\REST\\Common\\Input\\ParsingDispatcher->parse(NULL, 'application\/vnd...')\n#2 \/var\/www\/apache2php53\/ezpublish5\/vendor\/ezsystems\/ezpublish-kernel\/eZ\/Publish\/Core\/REST\/Server\/Controller\/Content.php(294): eZ\\Publish\\Core\\REST\\Common\\Input\\Dispatcher->parse(Object(eZ\\Publish\\Core\\REST\\Common\\Message))\n#3 [internal function]: eZ\\Publish\\Core\\REST\\Server\\Controller\\Content->createContent()\n#4 \/var\/www\/apache2php53\/ezpublish5\/vendor\/symfony\/symfony\/src\/Symfony\/Component\/HttpKernel\/HttpKernel.php(129): call_user_func_array(Array, Array)\n#5 \/var\/www\/apache2php53\/ezpublish5\/vendor\/symfony\/symfony\/src\/Symfony\/Component\/HttpKernel\/HttpKernel.php(73): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw(Object(Symfony\\Component\\HttpFoundation\\Request), 1)\n#6 \/var\/www\/apache2php53\/ezpublish5\/vendor\/symfony\/symfony\/src\/Symfony\/Component\/HttpKernel\/DependencyInjection\/ContainerAwareHttpKernel.php(57): Symfony\\Component\\HttpKernel\\HttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#7 \/var\/www\/apache2php53\/ezpublish5\/vendor\/symfony\/symfony\/src\/Symfony\/Component\/HttpKernel\/Kernel.php(197): Symfony\\Component\\HttpKernel\\DependencyInjection\\ContainerAwareHttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#8 \/var\/www\/apache2php53\/ezpublish5\/web\/index_dev.php(14): Symfony\\Component\\HttpKernel\\Kernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request))\n#9 {main}","file":"\/var\/www\/apache2php53\/ezpublish5\/vendor\/ezsystems\/ezpublish-kernel\/eZ\/Publish\/Core\/REST\/Server\/Input\/Parser\/ContentCreate.php","line":99}} ###################### - Target reply END - ###########################
JSON parsed, that reply look like this:
object(stdClass)#3157 (1) { ["ErrorMessage"]=> object(stdClass)#3163 (7) { ["_media-type"]=> string(40) "application/vnd.ez.api.ErrorMessage+json" ["errorCode"]=> int(500) ["errorMessage"]=> string(21) "Internal Server Error" ["errorDescription"]=> string(62) "Missing or invalid 'LocationCreate' element for ContentCreate." ["trace"]=> string(1813) "#0 /var/www/apache2php53/ezpublish5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/REST/Common/Input/ParsingDispatcher.php(79): eZ\Publish\Core\REST\Server\Input\Parser\ContentCreate->parse(NULL, Object(eZ\Publish\Core\REST\Common\Input\ParsingDispatcher)) #1 /var/www/apache2php53/ezpublish5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/REST/Common/Input/Dispatcher.php(112): eZ\Publish\Core\REST\Common\Input\ParsingDispatcher->parse(NULL, 'application/vnd...') #2 /var/www/apache2php53/ezpublish5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/REST/Server/Controller/Content.php(294): eZ\Publish\Core\REST\Common\Input\Dispatcher->parse(Object(eZ\Publish\Core\REST\Common\Message)) #3 [internal function]: eZ\Publish\Core\REST\Server\Controller\Content->createContent() #4 /var/www/apache2php53/ezpublish5/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php(129): call_user_func_array(Array, Array) #5 /var/www/apache2php53/ezpublish5/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php(73): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #6 /var/www/apache2php53/ezpublish5/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #7 /var/www/apache2php53/ezpublish5/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(197): Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #8 /var/www/apache2php53/ezpublish5/web/index_dev.php(14): Symfony\Component\HttpKernel\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #9 {main}" ["file"]=> string(125) "/var/www/apache2php53/ezpublish5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/REST/Server/Input/Parser/ContentCreate.php" ["line"]=> int(99) } }
Attachments
Issue Links
- relates to
-
EZP-20697 eZRest v2 : Not possible to publish objects containing ezimage contentfieldtype
- Closed
-
EZP-20697 eZRest v2 : Not possible to publish objects containing ezimage contentfieldtype
- Closed
-
EZP-20708 eZRest v2 : Not possible to publish objects containing ezxmltext contentfieldtype
- Closed
-
EZP-20769 REST v2: Reading object containing ezimage datatype returns hardcoded ( and wrong ) results
- Closed
-
EZP-20710 Improve error handling of the REST API
- Backlog