Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-20903

Not possible to create a new content with JSON request

    Details

      Description

      [Tue May 21 19:31:19 2013] [error] [client 107.23.129.198] PHP Warning: DOMDocument::loadXML(): Start tag expected, '<' not found in Entity, line: 1 in /var/www/html/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/FieldType/XmlText/Type.php on line 186
      [Tue May 21 19:31:19 2013] [error] [client 107.23.129.198] PHP Fatal error: Call to a member function hasChildNodes() on a non-object in /var/www/html/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/FieldType/XmlText/Type.php on line 123

      This is the request to REST server:

      POST /api/ezp/v2/content/objects HTTP/1.1
      Authorization:
      Basic YWRtaW46MTIzNA==
      Host:
      api.demo.ez.no
      Content-Length:
      1061
      X-Target-URI:

      Accept:
      application/vnd.ez.api.Content+json
      Content-Type:
      application/vnd.ez.api.ContentCreate+json
      Connection:
      Keep-Alive

      {
      "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",
      "remoteId": "remoteId12345678",
      "fields": {
      "field": [

      { "fieldDefinitionIdentifier": "name", "languageCode": "eng-GB", "fieldValue": "New Folder" }

      ,

      { "fieldDefinitionIdentifier": "short_description", "languageCode": "eng-GB", "fieldValue": "This is a short description" }

      ]
      }
      }
      }

        Activity

        Hide
        Łukasz Serwatka added a comment -

        It works with following JSON structure:

        {
        "ContentCreate": {
        "ContentType":

        { "_href": "/content/types/1" }

        ,
        "mainLanguageCode": "eng-GB",
        "User":

        { "_href": "/user/users/14" }

        ,
        "LocationCreate": {
        "ParentLocation":

        { "_href": "/content/locations/1/2" }

        ,
        "priority": "0",
        "hidden": "false",
        "sortField": "PATH",
        "sortOrder": "ASC"
        },
        "Section":

        { "_href": "/content/sections/1" }

        ,
        "alwaysAvailable": "true",
        "remoteId": "remoteId12345678",
        "modificationDate": "2012-10-18T11:00:00",
        "fields": {
        "field": [

        { "fieldDefinitionIdentifier": "name", "languageCode": "eng-GB", "fieldValue": "New Folder" }

        ,
        {
        "fieldDefinitionIdentifier": "short_description",
        "languageCode": "eng-GB",
        "fieldValue":

        { "xml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><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/\"><section><paragraph>This is short description</paragraph></section></section>" }

        }
        ]
        }
        }
        }

        Show
        Łukasz Serwatka added a comment - It works with following JSON structure: { "ContentCreate": { "ContentType": { "_href": "/content/types/1" } , "mainLanguageCode": "eng-GB", "User": { "_href": "/user/users/14" } , "LocationCreate": { "ParentLocation": { "_href": "/content/locations/1/2" } , "priority": "0", "hidden": "false", "sortField": "PATH", "sortOrder": "ASC" }, "Section": { "_href": "/content/sections/1" } , "alwaysAvailable": "true", "remoteId": "remoteId12345678", "modificationDate": "2012-10-18T11:00:00", "fields": { "field": [ { "fieldDefinitionIdentifier": "name", "languageCode": "eng-GB", "fieldValue": "New Folder" } , { "fieldDefinitionIdentifier": "short_description", "languageCode": "eng-GB", "fieldValue": { "xml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><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/\"><section><paragraph>This is short description</paragraph></section></section>" } } ] } } }

          People

          • Assignee:
            Unassigned
            Reporter:
            Łukasz Serwatka
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: