SiteVision Model REST API

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.

Activate the 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.

REST API in the Site settings

The REST API settings is available via the Site settings

REST API documentation

Enabling the REST API also exposes the REST API documentation to all users that has the DEVELOPER permission!

REST API documentation overview

REST API documentation overview

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

Nodes

Browsing the JCR Model

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.

REST API documentation for the OnlineIndex

REST API documentation for the Online index

Selecting a Method

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.

REST API documentation for the Search method on the OnlineIndex

REST API documentation for the Search method on the Online index

REST API URLs

Each node and endpoint has two different URLs that can be used.

  1. JCR Node Path-based URL
  2. JCR Identifier-based URL
REST API URLs

There are two REST API URLs to each endpoint

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!

REST API URL Pattern

The pattern of a REST API URL is:

<protocol> :// <domain> / rest-api / <rest api version> / <model version> / <path | identifier> / <method>

Where:

  • The <rest api version> specifies which version of the REST API that should be executed. There are currently only one version, so for now it should always be "1".
  • The <model version> specifies what model version to use. For offline data it should be "0" and for online data it should be "1". In the REST API documentation "0" is always used (so a developer can get full data even if the website or certain pages have been published) but when writing actual code that invokes the REST API "1" should in almost all cases be used!
  • The <path | identifier> specifies a Node in the JCR Model. As mentioned above, the identifier is always recommended over the path.
  • The <method> specifies the actual endpoint. It is always the lowercased name of the actual Method.

Example:

https://mydomain.se/rest-api/1/1/303.online-4.5/search

The REST API Console

The REST API Console can be used to test invocations of REST API endpoints.

  1. Enter the endpoint URL (i.e. paste in the URL you typically copied when you browsed the JCR Model tree and selected a Method available for that specific Node)
  2. Potentially enter input data required/supported by the endpoint
  3. Select type (Http Verb).
    NOTE! This is REAL invocations, be careful if you do a POST, PUT or a DELETE!
  4. Press the submit button
  5. Voila! See the invocation result!
The REST API Console

The REST API Console parts

Console Example

Example of REST API Console usage

Example of REST API Console usage