Logotype Sitevision Developer
Log in
Log in

Getting started with RESTApps

To quickly get started with RESTApps 2 in Sitevision we recommend using the Create Sitevision App project. Bundled RESTApps created from Create Sitevision App will generate a boilerplate app with two dependencies:

  1. @sitevision/sitevision-script - provides deployment scripts and Sitevision optimized webpack build configuration. This means you can focus entirely on your code rather than tedious build configuration.
  2. @sitevision/api - provides TypeScript definitions for Sitevision's Public API, which means you will get IntelliSense support when working with Sitevision's Public API.

Please refer to the Create Sitevision App Readme on how to get started using the tool.

The anatomy of a RESTApp

A RESTApp is simply a predefined file structure.

  • index.js *mandatory
    • The starting point for a RESTApp. This is where endpoints are created.
  • manifest.json *mandatory
    • The manifest cointains metadata for a RESTApp, such as version, id and type.
  • config/
    • Put configuration files here. Valid configuration files are:
      • index.html
      • index.js
      • config.js
      • config.css
  • resource/ (Since 4.5.1)
    • Static resources.

SDK

Many utilites and APIs are available when working with RESTApps. Check out the SDK documentation.

Targeting a RESTApp

The URL to a RESTApp looks like this:
<domain>/rest-api/<addonName>/<restAppRoute>

Note that the name of the addon will be part of the RESTApp's URL. Hence it is important to choose a simple URL friendly name.

Loop protection

Sitevision will transform bundled apps to protect against infinite loops. The protection process takes place when a bundled app is deployed. This may take a couple of seconds depending on the size and complexity of the bundled app. Calls to the bundled app will not be possible until the protection process is complete. Hence, it is not recommended to force-deploy a bundled app in a production environment.

Did you find the content on this page useful?