title: Apache Sling: Accessing Versions through REST API
body: <p>I am trying to retrieve the version history of a versionable node in Sling.</p>
  
  <p>I have created a versionable node, checked out, uploaded a new version and checked it in.</p>
  
  <pre><code>curl -u admin:admin -T test.txt http://localhost:8080/apps/versions2
  curl -u admin:admin http://localhost:8080/apps/versions2/test.txt -X POST -F"jcr:mixinTypes=mix:versionable"
  curl -u admin:admin http://localhost:8080/apps/versions2/test.txt -X POST -F":operation=checkout"
  curl -u admin:admin -T test.txt http://localhost:8080/apps/versions2/test.txt
  curl -u admin:admin http://localhost:8080/apps/versions2/test.txt -X POST -F":operation=checkin"
  </code></pre>
  
  <p>However, when I try to pull the version history as suggested by <a href="https://issues.apache.org/jira/browse/SLING-4318" rel="nofollow noreferrer">this enhancement request</a> it does not work.</p>
  
  <pre><code>curl -u admin:admin http://localhost:8080/apps/versions2/test.txt.V.tidy.json
  {
  "jcr:primaryType": "nt:file",
  "jcr:mixinTypes": ["mix:versionable"],
  "jcr:createdBy": "admin",
  "jcr:versionHistory": "31d1e0e8-22b0-476d-b591-b7441073f0fc",
  "jcr:predecessors": [],
  "jcr:created": "Mon Nov 20 2017 13:31:47 GMT+0100",
  "jcr:baseVersion": "00b9682c-9402-4c5f-a759-8f1837e55e35",
  "jcr:isCheckedOut": "false",
  "jcr:uuid": "0e1784aa-51c2-4901-b56d-89f8dcea9744"
  }
  </code></pre>
  
  <p>My plan B was to read the nodes from <code>/jcr:system/jcr:versionStorage</code> but I have no idea how to access it through the WebDAV API.</p>