ModeShape's RESTful API was intended to be used by HTTP clients, so it's quite easy to write a simple client application to read and write repository content using the RESTful API. However, since our trusty web browser is indeed a simple HTTP client, we can use it to directly interact with the RESTful API. It might not be pretty, but it works beautifully.
The RESTful API is nothing more than a simple JAX-RS web application that is packaged as a WAR file and that comes in 2 flavors:
- modeshape-web-jcr-rest-war - is a war file artifact available via Maven that can be deployed into any servlet container. To access it, include the following dependency in your project's POM:
- ModeShape's AS7 kit - once installed into AS7, in provides the RESTful API out-of-the-box, via a web application
Both web applications use Basic HTTP Authentication and require a role named connect to be present in the authenticated user's set of roles.
ModeShape 3 provides two different versions of the RESTful API:
- REST Service 2.x - the version which was included in ModeShape 2 and which has been deprecated. However, for backwards compatibility it is still accessible using the v1 URL prefix: http://<host>:<port>/<context>/v1/
- REST Service 3.x - a newer version which is an extension of the old one, plus a number of additional improvements.