-
1. Re: How to fetch file content using IRestClient?
rhauch Sep 7, 2010 2:06 PM (in response to zazo7)The REST service does allow you to query content, and as you show it returns the result set in the form of a JSON response. So, your question about how to get the file content is a bit of a loaded question.
First of all, the location of each node is given in the JSON response via the "jcr:path" property, and you can easily turn this into a resource URL by appending the path to the "item" resource URL (see Section 11.2.1 of the Reference Guide). You can then obtain each node via a GET request with these URLs. This will return the full JSON representation of the node, with any binary content encoded using Base64. (JSON doesn't really address binary data well.) Thus, using the REST service is not terribly conducive to working with files and folders. If you have any suggestions for improving this, please let us know.
If you are working with files and folders, you could transform the paths in your JSON result set into WebDAV URLs, and could very easily get the content of the file through WebDAV. See Section 11.1 of the Reference Guide for details on configuring the WebDAV server. Any WebDAV Java client library should work.
BTW, none of the query languages are capable of returning binary properties in the result set. This is not required by the spec (and in some of the languages it is not permitted), and in almost all cases (really, in all cases except for one or two records) would perform badly anyway.
-
2. Re: How to fetch file content using IRestClient?
rhauch Sep 7, 2010 2:22 PM (in response to rhauch) -
3. Re: How to fetch file content using IRestClient?
zazo7 Sep 23, 2010 2:34 PM (in response to rhauch)Randall Hauch wrote:
You can then obtain each node via a GET request with these URLs. This will return the full JSON representation of the node, with any binary content encoded using Base64.
The above worked just fine. Thanks a lot for the quick answer. Keep up the good work!