Red Hat Training

A Red Hat training course is available for Red Hat JBoss Data Virtualization

17.24. Query the Content Repository

Queries can be executed through the REST interface by sending a POST request to the query URI with the query statement in the body of the request. The query language must be specified by setting the appropriate MIME type.
All queries for a given workspace are posted to the same URI and the request body is not JSON-encoded.
POST http://www.example.com/modeshape-rest/eds/default/query

/a/b/c/d[@foo='bar']
Assuming that the above request was a POST with a content type of application/jcr+xpath, a response would be generated that consisted of a JSON object that contained a property named rows. The rows property would contain an array of rows with each element being a JSON object that represented one row in the query result set.
{
   "types": {
      "someProperty": "STRING",
      "someOtherProperty": "BOOLEAN",
      "jcr:path": "STRING",
      "jcr:score": "DECIMAL"
   },
   "rows": {
      {
         "someProperty": "foobar",
         "someOtherProperty": "true",
         "jcr:path" : "/a/b/c/d",
         "jcr:score" : 0.9327
      },
      {
         "someProperty": "localValue",
         "someOtherProperty": "false",
         "jcr:path" : "/a/b/c/d[2]",
         "jcr:score" : 0.8143
      }
   }
}
The JSON object in the response also contains a types property. The value of the types property is a JSON object that maps column names to their JCR type.