This is all about hacking around with a running Sling and just a curl on the command line. It concentrates on the default servlets in Sling that provide json representations of JCR nodes and properties and allow for POSTing with normal forms to update properties.
GETting a json representation:
curl -s -u admin:admin http://localhost:8080/content/path/to/node.infinity.json
The "-s" means silent, ie. no download progress indicator displayed.
The Sling default servlet may respond with a 300 and a json array containing the deepest level of recursion that is possible, as infinity can return a lot of data on a large repository.
POSTing:
- single value property:
curl -F "property=value" -u user:password http://localhost:8080/content/path/to/node
- multi value propery:
curl -F "property=value1" -F "property=value2" -u user:password http://localhost:8080/content/path/to/node
Add parameter "-v" to see the HTTP headers in the console.
1 Comment
Lars Trieloff
An alternative to curl might be this Firefox extension: https://addons.mozilla.org/en-US/firefox/addon/2691, called Poster which provides a graphical interface to creating HTTP requests.