Sitevision provides a built-in Model REST API that operates on the JCR data tree model that is also accessible via the Sitevision Public API. The authentication and permissions that are required to access the data via the REST API is exactly the same as it is in the Sitevision editor and via the Public API.
The Model REST API is bundled with all Sitevision installations, but it must be explicitly activated on the website. The Model REST API can be activated under the site settings in the Sitevision editor.
Enabling the REST API also exposes the REST API documentation to all users that has the DEVELOPER permission!
Be sure to log on to the website and ensure your user has the DEVELOPER permission. The REST API documentation for your REST API-enabled website is available at:
<protocol> :// <domain> / rest-api / doc
When you enter the REST API documentation you see the Nodes view. The JCR Model tree can be browsed via the links in the left menu. All available Methods/Operations will be displayed for each Node you navigate to.
When you have browsed to a Node in the JCR Model tree and selected a Method/Operation, its documentation is displayed. The documentation specifies the supported http verbs (GET, POST, PUT, DELETE) and the data requirements. It often also gives an example of input data and the corresponding JSON result.
Each node and endpoint has two different URLs that can be used.
The pattern of a REST API URL is:
<protocol> :// <domain> / rest-api / <api version> / <model version> / <path | identifier> / <method>
The <model version> should typically be 1 ("online") in a REST URL when used externally!
=> External invokers of the REST API should typically behave as typical site visitors, i.e. use the "online" model version (1).
The parts of a JCR Node Path-based URL contains JCR Node Names (as of javax.jcr.Node.getName() values). Note that not all chars are allowed in a JCR Node Name! The JSR 283 specification states that these chars are forbidden and must be replaced:
|Illegal character||Substitution character|
|/ (U+002F) "slash"||U+F02F|
(URL-encoded as: %EF%80%AF)
|* (U+002A) "asterix"||U+F02A|
(URL-encoded as: %EF%80%AA)
|: (U+003A) "colon"||U+F03A|
(URL-encoded as: %EF%80%BA)
|[ (U+005B) "left bracket"||U+F05B|
(URL-encoded as: %EF%81%9B)
|] (U+005D) "right bracket"||U+F05D|
(URL-encoded as: %EF%81%9D)
|| (U+007C) "pipe"||U+F07C|
(URL-encoded as: %EF%81%BC)
As explained above, you can never have a name like "
some/name" as part when using the Path-based URL to invoke the REST API. That name is simply not a JCR Node Name!
The proper name to use would be something like "
somename" (i.e. the presumed slash should be a U+F02F character). URL-encoded it would be: "
Sitevision tries to be lenient and forgiving even if a part of a Path-based REST API URL contains illegal characters. As a precaution, all potential illegal characters will be substituted using EndecUtil.escapeJcrName before the final resource is resolved. This will handle some invalid (non-JCR) names but some cases simply can not be solved by Sitevision:
The JCR Identifier-based URL contains a Node Identifier (as of javax.jcr.Node.getIdentifier() value).
Always use the Identifier-based URL whenever possible!
The Identifier-based URL is significantly faster than the path-based URL and it is also safer since it guarantees there will never be a name collision!
The REST API Console can be used to test invocations of REST API endpoints.