Fork me on GitHub

Command Line Examples

Here are examples with `curl` command (See http://jukkaz.wordpress.com/2009/11/24/jackrabbit-over-http/ for detail about the original examples.):

Creating a node - creates 'hello' node under the root node:

$ curl --request MKCOL --data @- --user admin:admin \
> http://localhost:8080/cms/server/default/jcr:root/hello/ <<END
> <sv:node sv:name="hello" xmlns:sv="http://www.jcp.org/jcr/sv/1.0">
> <sv:property sv:name="message" sv:type="String">
> <sv:value>Hello, World!</sv:value>
> </sv:property>
> <sv:property sv:name="date" sv:type="Date">
> <sv:value>2012-12-31T12:00:00.000Z</sv:value>
> </sv:property>
> </sv:node>
> END
          

If you set the init parameter, doMkcolOnPost, to true (false by default) for the JCRWebdavServer servlet (see Installation page), then you can use POST method as well as MKCOL method to create a node like the following:

$ curl --request POST --header "Content-Type: application/xml" --data @- --user admin:admin \
> http://localhost:8080/cms/server/default/jcr:root/hello/ <<END
> <sv:node sv:name="hello" xmlns:sv="http://www.jcp.org/jcr/sv/1.0">
> <sv:property sv:name="message" sv:type="String">
> <sv:value>Hello, World!</sv:value>
> </sv:property>
> <sv:property sv:name="date" sv:type="Date">
> <sv:value>2012-12-31T12:00:00.000Z</sv:value>
> </sv:property>
> </sv:node>
> END
          

Read the node:

$ curl --user admin:admin http://localhost:8080/cms/server/default/jcr:root/hello/
<?xml version="1.0" encoding="UTF-8"?>
<sv:node xmlns:sv="http://www.jcp.org/jcr/sv/1.0" sv:name="hello">
  <sv:property sv:name="jcr:primaryType" sv:type="Name">
    <sv:value>nt:unstructured</sv:value>
  </sv:property>
  <sv:property sv:name="date" sv:type="Date">
    <sv:value>2012-12-31T12:00:00.000Z</sv:value>
  </sv:property>
  <sv:property sv:name="message" sv:type="String">
    <sv:value>Hello, World!</sv:value>
  </sv:property>
</sv:node>
          

Update 'date' property of the 'hello' node:

$ curl --request PUT --header "Content-Type: jcr-value/date" \
> --data "2012-12-30T12:00:00.000Z" --user admin:admin \
> http://localhost:8080/server/default/jcr:root/hello/date
          

Update 'history' property of the 'hello' node:

$ curl --request PUT --header "Content-Type: jcr-value/string" \> --data "Document data updated" --user admin:admin \
> http://localhost:8080/cms/server/default/jcr:root/hello/history
          

Delete the node:

$ curl --request DELETE --user admin:admin \
> http://localhost:8080/cms/server/default/jcr:root/hello/