0 Replies Latest reply on Jun 5, 2012 2:43 PM by BrettHazen

    Specify JCR Property Type with Sling REST API

    BrettHazen Level 1

      I'm doing a content migration and using the Sling REST API and cURL to created the content in CQ. 

       

      I've got a cURL command that looks like this:

      curl -D - -X POST -u admin:admin -F ":operation=import" -F ":contentType=jcr.xml"  -F ":nameHint=test_news_page" -F ":content=@testpage.xml" -F ":replace=true" http://localhost:4502/content/myapp/en/home/presscenter/articles/2011/08/29/

       

      And XML that looks like this:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <news_test_page

      xmlns:sling="http://sling.apache.org/jcr/sling/1.0"

      xmlns:cq="http://www.day.com/jcr/cq/1.0"

      xmlns:jcr="http://www.jcp.org/jcr/1.0"

      jcr:primaryType="cq:Page"

      >

        <jcr:content

                cq:template="/apps/myapp/templates/generic3col"

                jcr:primaryType="cq:PageContent"

                jcr:title="Test News Page"

                sling:resourceType="/apps/myapp/components/page/generic3col"

                            >

                           

                            <leftparsys

                                    sling:resourceType="foundation/components/parsys"

                            >

                                    <presscenterleftnav

                                              sling:resourceType="myapp/components/content/presscenterLeftNav"

                                    />

                            </leftparsys>

                           

                            <centerparsys

                                    sling:resourceType="foundation/components/parsys"

                            >

                                    <article

                                              date="5/23/2012"

                                              searchDate="2012-06-05T00:00:00.000-05:00"

                                              jcr:createdBy="admin"

                                              jcr:lastModifiedBy="migration"

                                              sling:resourceType="myapp/components/content/article"

                                              text="&lt;p&gt;from the command line&lt;/p&gt;"

                                              textIsRich="true"

                                              title="News Test Page Test"

                                    >

                                              <image

                                                        fileReference=""

                                                        imageRotate="0"

                                                        jcr:lastModified=""

                                                        jcr:LastModifiedBy="migration"

                                                        sling:resourceType="foundation/components/image"

                                                        width="0"

                                              >

                                              </image>

                                    </article>

                            </centerparsys>

        </jcr:content>

      </news_test_page>

       

      This all works fine and creates the node correctly.  However, in the article node in my XML, you'll noticed there's a property called "searchDate".  This gets added as a string in the JCR, but I need it to be of type date (client's code is dependent on this).  Is there a way to do this via the Sling REST API?

       

      If that's not possible, I'm open to suggestions on other ways to achieve the same goal.