It is possible to show Totalview users directly on a public website using the Totalview Rest API. This page is intended to help developers and administrators to get it up and running.
In order to be able to use this feature, a valid license must be obtained, otherwise, the API will not be accessible. In order to purchase a license, please contact your local sales representative.
Endpoint & Login information
The Totalview Rest API makes use of a public endpoint. Usually, this endpoint is located at tv.[yourdomain.com]:[portnumber]/rest (e.g. tv.frymil.fo:8034/rest). The login information needed to access the API can be found in the WCF Connector settings of the Totalview Admin:
Connecting to the API
Using both the endpoint and the login information, you are able to make the initial connection to the Totalview Rest API via the method ‘Userlogin‘. This can be done using any programming language capable of making HTTP Post requests. Below is an example using PHP (and cURL), where we send JSON data in an HTTP Post request to our endpoint URL in order to log in. (Please note that the ‘LoginClient’ should always be ‘4’ in this case)
$url = ‘http://tv.frymil.fo:8034/rest/Userlogin’;
$ch = curl_init($url);
//The JSON data.
$jsonData = array(
‘Username’ => ‘Admin’,
‘password’ => ‘*****’,
‘LoginClient’ => 4
//Encode the array into JSON.
$jsonDataEncoded = json_encode($jsonData);
//Tell cURL that we want to send a POST request.
curl_setopt($ch, CURLOPT_POST, 1);
//Attach our encoded JSON string to the POST fields.
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonDataEncoded);
//Set the content type to application/json
curl_setopt($ch, CURLOPT_HTTPHEADER, array(‘Content-Type: application/json’));
//Execute the request
$result = curl_exec($ch);
The result of a successful call will be a JSON response in the following format:
A JSON message containing “Authenticated: true” signifies a sucessful login and will provide a token identifier called UserGUID. This token is meant to be used to retrieve the list of users and their state information.
Retrieving user information
Given the login token from the previous step, it is then possible to get all published users by calling “GetPublishedUsers”:
$rawdata = file_get_contents(‘http://tv.frymil.fo:8034/rest/GetPublishedUsers?UserGID=”‘. $GUID .‘”&includePictures=false’);
The parameter “includePictures” determines whether or not to include image data for each user. Setting this to “true” will send base64 image strings along with the request.
The result of a successful call will be a JSON reponse in the following format:
You can enable/disable users being shown by going to “Totalview Admin” -> “User” and checking the “Publish User” box.
Managing Published States
In order to hide the internal states for your company, you can set up published states that will be shown instead. This can be done by going to “Totalview Admin” -> “State”. Simply create the new states and make sure that the visibility for all clients is disabled. These can then be assigned to other states by selecting them in the “Published State” dropdown:
In some cases, there might be problems with firewalls, as they might restrict the traffic to the endpoint. Make sure that all traffic to and from the endpoint over the specified port is allowed.