RESTApps
RESTApps makes it possible to create custom REST endpoints in Sitevision. This enables flexible Headless CMS implementations based on Sitevision. RESTApps also offer a powerful yet simple way to enrich Sitevision websites with new methods to expose data, as well as new methods to create and manage content.
A RESTApp can also react to system events, timer events and custom events to perform tasks. It can also persist data in a DataStore. RESTApps are the Serverless functions and Microservices of Sitevision.
Development of a RESTApp takes place outside of Sitevision in a code editor of choice. RESTApps and WebApps have a lot in common when it comes to development and deployment.
RESTApps vs. WebApps
RESTApps and WebApps is based on the same technology, their API:s are very similar and the development process is likely the same. There are some profound differences though:
- RESTApps offer no rendering possibilities
- RESTApps can send and act on server-side events
RESTApps as request/response aggregators
RESTApps can be used to effectively diminish the latency and overhead that lots of http calls to the Sitevision Model REST API would have.
For instance, to update a sv:simpleUser you typically do a http PUT request to the simpleuser endpoint with data and get the result of the operation back. Hence, to update three users you must do three http requests and so on. The http latency and overhead cost is linear. RESTApps can be used to almost completely get rid of such additional linear costs.
The receipe is to create a RESTApp that receives a single request (with data for multiple REST invocations) and then let the RESTApp split the data up, execute the Sitevision Model REST API, server-side - multiple times. The RESTApp then returns a response with the result of all REST invocations. This aggregating facade-approach is typically implemented using the requireable RestApi utility of the Sitevision API. It has a single latency and minimal http overhead cost.
Sitevision Utility API Tip!
Use the RestApi utility to execute server-side invocations of the Sitevision Model REST API.
Using RESTApps from other apps
A RESTApp provides/exposes an API for external callers. This API can be used from other apps on the same site aswell via the requireable RestAppInvoker utility of the Sitevision API.
Sitevision Utility API Tip!
Use the RestAppInvoker utility to do server-side invocations of a RESTApp.
RESTApps1 is deprecated
RESTApps2 is an evolved and enhanced version of the original RESTApps framework, focusing on better performance, modern JavaScript support, improved security, and ease of use for developers.