
Mosart REST API
Version 1.2 | Published July 14, 2021 ©
Mosart REST API Version 1.2
Purpose
Along with the NCS Plugin, a new REST API has been created for exposing Viz Mosart templates to external parties. The API enables third party vendors to gain access to the data contained in a Viz Mosart template and can also be used for creating MOS objects.
Prerequisites
-
Operating system: Windows 10
-
ASP.NET Core Hosting Bundle 3.1 (https://dotnet.microsoft.com/download/dotnet/3.1/runtime)
-
Viz Mosart 4.1.0 or later
Installation
The Mosart REST API is standalone, with its own installer.
-
Install the API (MosartRestApi-1.2.0.0.msi). This should be on the same machine as Mosart Server (if using Template Database, it can be on any machine that has access to the DB).
Windows Service and Monitoring Locations
-
At installation, the Mosart REST API installs a Windows service Mosart REST API. This appears in the list of services at:
Control Panel > All Control Panel Items > Administrative Tools > Services.In case of API failure, the service might stop, and require starting again.
-
At installation the API monitors by default, templates and other files under the c:\channeltemplates folder. These comprise:
-
channeltemplates.xml
-
avconfig.xml
-
newsroomsettings.xml
-
Changing Location of Monitored Templates
You can change the location of monitored template data to an address other than the default file location (c:\channeltemplates), or to a template database.
Changing location of template file
The location of monitored template set(s) is defined in the appsettings.json file. This configurable file is stored in the installation folder at
C:\Program Files (x86)\Mosart Medialab\MosartRestApi\appsettings.json.
-
If you want the API to read from FILES, set StorageType to Local.
See the table Configurable Template Location Parameters.
Changing the template database source
-
If you want the API to read from the Mosart MySql template database, set StorageType to Local and define DatabaseStorage.ConnectionString.
See the table below, Configurable Template Location Parameters.
Configurable Template Location Parameters
All fields below are contained in the configuration file appsettings.json
Field |
Default value |
Description |
StorageType |
Local |
Local or Database |
LocalStorage.channel-templates-xml |
C:\\channeltemplates\\channeltemplates.xml |
Path to channeltemplates xml file |
LocalStorage.avconfig-xml |
C:\\channeltemplates\\avconfig.xml |
Path to avconfig xml file |
LocalStorage.newsroomsettings-xml |
C:\\channeltemplates\\newsroomsettings.xml |
Path to newsroomsettings xml file |
DatabaseStorage.ConnectionString |
host=localhost;username=root;password=pwd;database=templatedb |
Connection string to Mosart MySQL template db |
API Documentation
When the API has been installed, details about the API endpoints are provided in the open API documentation (Swagger Open API (OAS) documentation) at:
http://localhost:55142/docs
(If the API is installed at another computer, replace localhost with the IP address of the other computer).
Examples
-
Retrieve all galleries:
http://localhost:55142/api/v1/galleries
(A list of gallery names is obtained) -
Choose a gallery name from the list obtained in the previous example. For the sake of this example, assume that Local was on the list. (If not, choose some other gallery name.)
To retrieve the template sets for the gallery named Local:
http://localhost:55142/api/v1/galleries/Local/templatesets.