Details
-
Bug
-
Resolution: Fixed
-
Medium
-
5.0, 5.1.0beta1
-
None
-
rhel, mysql
Description
(See comments for the "true" issue)
Seems like you have to provide values for all fields when creating new objects, also including fields which are not "required"
Here I create a folder ( on a ezflow installation) with all fields defined ( also those which are not required ). This works fine:
#################### - 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: 2362 Authorization: Basic YWRtaW46cHVibGlzaA== Accept: application/vnd.ez.api.Content+json Content-type: application/vnd.ez.api.ContentCreate+json { "ContentCreate": { "ContentType": { "_href": "/content/types/1" }, "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": "SubTreeA" },{ "fieldDefinitionIdentifier": "short_name", "languageCode": "eng-GB", "fieldValue": "SubTreeA" },{ "fieldDefinitionIdentifier": "short_description", "languageCode": "eng-GB", "fieldValue": { "xml" : "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<section xmlns:image=\"http://ez.no/namespaces/ezpublish3/image/\" xmlns:xhtml=\"http://ez.no/namespaces/ezpublish3/xhtml/\" xmlns:custom=\"http://ez.no/namespaces/ezpublish3/custom/\"><paragraph xmlns:tmp=\"http://ez.no/namespaces/ezpublish3/temporary/\">shortdescription value</paragraph></section>\n" } },{ "fieldDefinitionIdentifier": "description", "languageCode": "eng-GB", "fieldValue": { "xml" : "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<section xmlns:image=\"http://ez.no/namespaces/ezpublish3/image/\" xmlns:xhtml=\"http://ez.no/namespaces/ezpublish3/xhtml/\" xmlns:custom=\"http://ez.no/namespaces/ezpublish3/custom/\"><paragraph xmlns:tmp=\"http://ez.no/namespaces/ezpublish3/temporary/\">description value</paragraph></section>\n" } },{ "fieldDefinitionIdentifier": "show_children", "languageCode": "eng-GB", "fieldValue": true },{ "fieldDefinitionIdentifier": "tags", "languageCode": "eng-GB", "fieldValue": [] },{ "fieldDefinitionIdentifier": "publish_date", "languageCode": "eng-GB", "fieldValue": { "rfc850" : "Thursday, 01-Jan-70 00:00:00 GMT+0000", "timestamp" : 0 } } ] } } } ##################### - Client request END - ########################## sending to target...done. Received from Target: ##################### - Target reply BEGIN - ########################## HTTP/1.1 201 Created Date: Thu, 18 Apr 2013 07:58:43 GMT Server: Apache/2.2.15 (Red Hat) X-Powered-By: PHP/5.3.3 Accept-Patch: application/vnd.ez.api.ContentUpdate+json Location: /api/ezp/v2/content/objects/64 Status: 201 Created Cache-Control: no-cache X-Debug-Token: 949a8b60fcf778a68b8002588db5e67942176e12 Connection: close Transfer-Encoding: chunked Content-Type: application/vnd.ez.api.Content+json cb4 {"Content":{"_media-type":"application\/vnd.ez.api.Content+json","_href":"\/api\/ezp\/v2\/content\/objects\/64","_remoteId":"92219bcbb5e79c89157290a4e125d366","_id":"64","ContentType":{"_media-type":"application\/vnd.ez.api.ContentType+json","_href":"\/api\/ezp\/v2\/content\/types\/1"},"Name":"SubTreeA","Versions":{"_media-type":"application\/vnd.ez.api.VersionList+json","_href":"\/api\/ezp\/v2\/content\/objects\/64\/versions"},"CurrentVersion":{"_media-type":"application\/vnd.ez.api.Version+json","_href":"\/api\/ezp\/v2\/content\/objects\/64\/currentversion","Version":{"_media-type":"application\/vnd.ez.api.Version+json","_href":"\/api\/ezp\/v2\/content\/objects\/64\/versions\/1","VersionInfo":{"id":"513","versionNo":1,"status":"DRAFT","modificationDate":"2012-09-30T12:30:00+02:00","Creator":{"_media-type":"application\/vnd.ez.api.User+json","_href":"\/api\/ezp\/v2\/user\/users\/14"},"creationDate":"2012-09-30T12:30:00+02:00","initialLanguageCode":"eng-GB","languageCodes":"eng-GB","names":{"value":[{"_languageCode":"eng-GB","#text":"SubTreeA"}]},"Content":{"_media-type":"application\/vnd.ez.api.ContentInfo+json","_href":"\/api\/ezp\/v2\/content\/objects\/64"}},"Fields":{"field":[{"id":"246","fieldDefinitionIdentifier":"name","languageCode":"eng-GB","fieldValue":"SubTreeA"},{"id":"247","fieldDefinitionIdentifier":"short_description","languageCode":"eng-GB","fieldValue":{"xml":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<section xmlns:image=\"http:\/\/ez.no\/namespaces\/ezpublish3\/image\/\" xmlns:xhtml=\"http:\/\/ez.no\/namespaces\/ezpublish3\/xhtml\/\" xmlns:custom=\"http:\/\/ez.no\/namespaces\/ezpublish3\/custom\/\"><paragraph xmlns:tmp=\"http:\/\/ez.no\/namespaces\/ezpublish3\/temporary\/\">shortdescription value<\/paragraph><\/section>\n"}},{"id":"248","fieldDefinitionIdentifier":"short_name","languageCode":"eng-GB","fieldValue":"SubTreeA"},{"id":"249","fieldDefinitionIdentifier":"description","languageCode":"eng-GB","fieldValue":{"xml":"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<section xmlns:image=\"http:\/\/ez.no\/namespaces\/ezpublish3\/image\/\" xmlns:xhtml=\"http:\/\/ez.no\/namespaces\/ezpublish3\/xhtml\/\" xmlns:custom=\"http:\/\/ez.no\/namespaces\/ezpublish3\/custom\/\"><paragraph xmlns:tmp=\"http:\/\/ez.no\/namespaces\/ezpublish3\/temporary\/\">description value<\/paragraph><\/section>\n"}},{"id":"250","fieldDefinitionIdentifier":"show_children","languageCode":"eng-GB","fieldValue":true},{"id":"252","fieldDefinitionIdentifier":"publish_date","languageCode":"eng-GB","fieldValue":{"timestamp":0,"rfc850":"Thursday, 01-Jan-70 00:00:00 GMT+0000"}},{"id":"251","fieldDefinitionIdentifier":"tags","languageCode":"eng-GB","fieldValue":[]}]},"Relations":{"_media-type":"application\/vnd.ez.api.RelationList+json","_href":"\/api\/ezp\/v2\/content\/objects\/64\/versions\/1\/relations","Relation":[]}}},"Section":{"_media-type":"application\/vnd.ez.api.Section+json","_href":"\/api\/ezp\/v2\/content\/sections\/1"},"Locations":{"_media-type":"application\/vnd.ez.api.LocationList+json","_href":"\/api\/ezp\/v2\/content\/objects\/64\/locations"},"Owner":{"_media-type":"application\/vnd.ez.api.User+json","_href":"\/api\/ezp\/v2\/user\/users\/14"},"mainLanguageCode":"eng-GB","alwaysAvailable":"true"}} ###################### - Target reply END - ###########################
However, If I remove just one of the non-required feilds, I get "database error":
#################### - 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: 2125 Authorization: Basic YWRtaW46cHVibGlzaA== Accept: application/vnd.ez.api.Content+json Content-type: application/vnd.ez.api.ContentCreate+json { "ContentCreate": { "ContentType": { "_href": "/content/types/1" }, "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": "SubTreeA" },{ "fieldDefinitionIdentifier": "short_name", "languageCode": "eng-GB", "fieldValue": "SubTreeA" },{ "fieldDefinitionIdentifier": "short_description", "languageCode": "eng-GB", "fieldValue": { "xml" : "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<section xmlns:image=\"http://ez.no/namespaces/ezpublish3/image/\" xmlns:xhtml=\"http://ez.no/namespaces/ezpublish3/xhtml/\" xmlns:custom=\"http://ez.no/namespaces/ezpublish3/custom/\"><paragraph xmlns:tmp=\"http://ez.no/namespaces/ezpublish3/temporary/\">shortdescription value</paragraph></section>\n" } },{ "fieldDefinitionIdentifier": "description", "languageCode": "eng-GB", "fieldValue": { "xml" : "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<section xmlns:image=\"http://ez.no/namespaces/ezpublish3/image/\" xmlns:xhtml=\"http://ez.no/namespaces/ezpublish3/xhtml/\" xmlns:custom=\"http://ez.no/namespaces/ezpublish3/custom/\"><paragraph xmlns:tmp=\"http://ez.no/namespaces/ezpublish3/temporary/\">description value</paragraph></section>\n" } },{ "fieldDefinitionIdentifier": "show_children", "languageCode": "eng-GB", "fieldValue": true },{ "fieldDefinitionIdentifier": "tags", "languageCode": "eng-GB", "fieldValue": [] } ] } } } ##################### - Client request END - ########################## sending to target...done. Received from Target: ##################### - Target reply BEGIN - ########################## HTTP/1.1 500 Internal Server Error Date: Thu, 18 Apr 2013 07:59:57 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: fd850d86a4fea9b8cf357fb065ec5ec8df466b87 Connection: close Transfer-Encoding: chunked Content-Type: application/vnd.ez.api.ErrorMessage+json f86 {"ErrorMessage":{"_media-type":"application\/vnd.ez.api.ErrorMessage+json","errorCode":500,"errorMessage":"Internal Server Error","errorDescription":"Database error","trace":"#0 \/var\/www\/apache2php53\/ezpublish5\/vendor\/ezsystems\/ezpublish-kernel\/eZ\/Publish\/Core\/Persistence\/Legacy\/Content\/FieldHandler.php(223): eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\Gateway\\ExceptionConversion->insertNewField(Object(eZ\\Publish\\SPI\\Persistence\\Content), Object(eZ\\Publish\\SPI\\Persistence\\Content\\Field), Object(eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\StorageFieldValue))\n#1 \/var\/www\/apache2php53\/ezpublish5\/vendor\/ezsystems\/ezpublish-kernel\/eZ\/Publish\/Core\/Persistence\/Legacy\/Content\/FieldHandler.php(135): eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\FieldHandler->createNewField(Object(eZ\\Publish\\SPI\\Persistence\\Content\\Field), Object(eZ\\Publish\\SPI\\Persistence\\Content))\n#2 \/var\/www\/apache2php53\/ezpublish5\/vendor\/ezsystems\/ezpublish-kernel\/eZ\/Publish\/Core\/Persistence\/Legacy\/Content\/Handler.php(148): eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\FieldHandler->createNewFields(Object(eZ\\Publish\\SPI\\Persistence\\Content))\n#3 \/var\/www\/apache2php53\/ezpublish5\/vendor\/ezsystems\/ezpublish-kernel\/eZ\/Publish\/Core\/Persistence\/Legacy\/Content\/Handler.php(119): eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\Handler->internalCreate(Object(eZ\\Publish\\SPI\\Persistence\\Content\\CreateStruct))\n#4 \/var\/www\/apache2php53\/ezpublish5\/vendor\/ezsystems\/ezpublish-kernel\/eZ\/Publish\/Core\/Persistence\/Cache\/ContentHandler.php(35): eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\Handler->create(Object(eZ\\Publish\\SPI\\Persistence\\Content\\CreateStruct))\n#5 \/var\/www\/apache2php53\/ezpublish5\/vendor\/ezsystems\/ezpublish-kernel\/eZ\/Publish\/Core\/Repository\/ContentService.php(640): eZ\\Publish\\Core\\Persistence\\Cache\\ContentHandler->create(Object(eZ\\Publish\\SPI\\Persistence\\Content\\CreateStruct))\n#6 \/var\/www\/apache2php53\/ezpublish5\/vendor\/ezsystems\/ezpublish-kernel\/eZ\/Publish\/Core\/SignalSlot\/ContentService.php(237): eZ\\Publish\\Core\\Repository\\ContentService->createContent(Object(eZ\\Publish\\Core\\Repository\\Values\\Content\\ContentCreateStruct), Array)\n#7 \/var\/www\/apache2php53\/ezpublish5\/vendor\/ezsystems\/ezpublish-kernel\/eZ\/Publish\/Core\/REST\/Server\/Controller\/Content.php(299): eZ\\Publish\\Core\\SignalSlot\\ContentService->createContent(Object(eZ\\Publish\\Core\\Repository\\Values\\Content\\ContentCreateStruct), Array)\n#8 [internal function]: eZ\\Publish\\Core\\REST\\Server\\Controller\\Content->createContent()\n#9 \/var\/www\/apache2php53\/ezpublish5\/vendor\/symfony\/symfony\/src\/Symfony\/Component\/HttpKernel\/HttpKernel.php(129): call_user_func_array(Array, Array)\n#10 \/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#11 \/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#12 \/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#13 \/var\/www\/apache2php53\/ezpublish5\/web\/index_dev.php(14): Symfony\\Component\\HttpKernel\\Kernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request))\n#14 {main}","file":"\/var\/www\/apache2php53\/ezpublish5\/vendor\/ezsystems\/ezpublish-kernel\/eZ\/Publish\/Core\/Persistence\/Legacy\/Content\/Gateway\/ExceptionConversion.php","line":236}} ###################### - Target reply END - ###########################