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

[REST] Can't fill fieldtype DateTime or Date

    XMLWordPrintable

Details

    Description

      The only value accepted to the DateTime fieldtype when create a content was a timestamp.
      However this was not filled.

      Steps to Reproduce:

      ( on admin interface )
      1 - create a content type
        - Attribute 1 - Type: "ezstring"
        - Attribute 1 - Name: "Name"
        - Attribute 1 - Identifier: "name"
        - Attribute 2 - Type: "ezdatetime"
        - Attribute 2 - Name: "DateTime"
        - Attribute 2 - Identifier: "datetime"
      
      ( on a REST client )
      1 - Send request:
      POST /api/ezp/v2/content/objects
      Accept: application/vnd.ez.api.Content+json
      Authentication: ( log as admin )
      Content-Type: application/vnd.ez.api.ContentCreate+xml
      Body: ( XML bellow )
      2 - Verify that on the response the current value of field DateTime is "0"
          ( response is also bellow )
      

      Request body:

      <ContentCreate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <ContentType href="/api/ezp/v2/content/types/48"/>
        <mainLanguageCode>eng-GB</mainLanguageCode>
        <LocationCreate>
          <ParentLocation href="/api/ezp/v2/content/locations/1/2" />
          <priority>0</priority>
          <hidden>false</hidden>
          <sortField>PATH</sortField>
          <sortOrder>ASC</sortOrder>
        </LocationCreate>
        <Section href="/api/ezp/v2/content/sections/1"/>
        <alwaysAvailable>true</alwaysAvailable>
        <fields>
          <field>
            <fieldDefinitionIdentifier>name</fieldDefinitionIdentifier>
            <languageCode>eng-GB</languageCode>
            <fieldValue>Test</fieldValue>
          </field>
          <field>
            <fieldDefinitionIdentifier>datetime</fieldDefinitionIdentifier>
            <fieldValue>1376910190</fieldValue>
          </field>
        </fields>
      </ContentCreate>
      

      Response:

          {
             "Content":
             {
                 "_media-type": "application/vnd.ez.api.Content+json",
                 "_href": "/api/ezp/v2/content/objects/62",
                 "_remoteId": "827490b145a386234493eed3180c7880",
                 "_id": "62",
                 "ContentType":
                 {
                     "_media-type": "application/vnd.ez.api.ContentType+json",
                     "_href": "/api/ezp/v2/content/types/48"
                 },
                 "Name": "Test",
                 "Versions":
                 {
                     "_media-type": "application/vnd.ez.api.VersionList+json",
                     "_href": "/api/ezp/v2/content/objects/62/versions"
                 },
                 "CurrentVersion":
                 {
                     "_media-type": "application/vnd.ez.api.Version+json",
                     "_href": "/api/ezp/v2/content/objects/62/currentversion",
                     "Version":
                     {
                         "_media-type": "application/vnd.ez.api.Version+json",
                         "_href": "/api/ezp/v2/content/objects/62/versions/1",
                         "VersionInfo":
                         {
                             "id": "511",
                             "versionNo": 1,
                             "status": "DRAFT",
                             "modificationDate": "2013-08-19T12:46:06+02:00",
                             "Creator":
                             {
                                 "_media-type": "application/vnd.ez.api.User+json",
                                 "_href": "/api/ezp/v2/user/users/14"
                             },
                             "creationDate": "2013-08-19T12:46:06+02:00",
                             "initialLanguageCode": "eng-GB",
                             "languageCodes": "eng-GB",
                             "names":
                             {
                                 "value":
                                 [
                                     {
                                         "_languageCode": "eng-GB",
                                         "#text": "Test"
                                     }
                                 ]
                             },
                             "Content":
                             {
                                 "_media-type": "application/vnd.ez.api.ContentInfo+json",
                                 "_href": "/api/ezp/v2/content/objects/62"
                             }
                         },
                         "Fields":
                         {
                             "field":
                             [
                                 {
                                     "id": "233",
                                     "fieldDefinitionIdentifier": "name",
                                     "languageCode": "eng-GB",
                                     "fieldValue": "Test"
                                 },
                                 {
                                     "id": "234",
                                     "fieldDefinitionIdentifier": "datetime",
                                     "languageCode": "eng-GB",
                                     "fieldValue":
                                     {
                                         "timestamp": 0,
                                         "rfc850": "Thursday, 01-Jan-70 00:00:00 GMT+0000"
                                     }
                                 }
                             ]
                         },
                         "Relations":
                         {
                             "_media-type": "application/vnd.ez.api.RelationList+json",
                             "_href": "/api/ezp/v2/content/objects/62/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/62/locations"
                 },
                 "Owner":
                 {
                     "_media-type": "application/vnd.ez.api.User+json",
                     "_href": "/api/ezp/v2/user/users/14"
                 },
                 "mainLanguageCode": "eng-GB",
                 "alwaysAvailable": "true"
             }
          }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            marcos.loureiro-obsolete@ez.no Marcos Loureiro (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Time Spent - 2 hours, 30 minutes Remaining Estimate - 1 hour, 30 minutes
                1h 30m
                Logged:
                Time Spent - 2 hours, 30 minutes Remaining Estimate - 1 hour, 30 minutes
                2h 30m