Access API's via HTML page
This document shows how to access API 2.0 through a simple HTML page.
Technical Details with Examples
The available HTML code can be accessed from the GitHub page. The below examples show illustrations of how to use the API through the HTML pages on your local machine.
The code is customizable. You can change the API calls within the code when you want to access a different API.
Get Audio Statics
This is a simple example to get some data to prepare a page to switch audio outputs on an MCM, after clicking the "Get Audio PIDs" button, the program queries MCM and gets PID, Channel Source ID, Language, and current short audio level average.
Copy the HTML code from here.
You can paste the copied HTML code into a notepad or notepad++ editor as .html file (e.g. Get_Audio_Statistics.html).Run the .html file (Double click on Get_Audio_Statistics.html) to view it on a browser. Enter the User Name and Password of your MCM and the IP/URL. Click on the Get Audio PIDs, this will return the PID, Channel Source ID, Language, and current short audio level average if it is present.
The API used here is GET :http://<ip_address:port>/api/2.0/channels/statistics/audio_pids_statistics/.json
Return Code 200 indicates a success response. If the Return Code is 0, the MCM is unreachable.
Get Encoder Information
This HTML page to get data for switching audio on a mosaic.
Copy the HTML code from here and follow step 1 and 2 similar to that of Get Audio Statics.
Click on Get Encoder Info, it will return the available data for switching audio on a mosaic along with 200 if the response is successful.
The API used here is GET :http://<ip_address:port>/api/2.0/outputs/config/.json
Audio Change Buttons
Taking data from the previous two pages, you can then change audio on the encoders with this simple page.
Copy the HTML code from here and run the HTML file
The API used here is GET :http://<ip_address:port>/api/2.0/outputs/command/setSourceAudioPid/enc_id/channel_id/audio_PID/.json
Tally Color Change
This example can be used for setting up tallies through HTML page using API version 5.0.
Copy the HTML code from here and run the HTML file. Enter the username and password, MCM IP and Tally Name (eg. TestTally_new). Choose the desired color from Color 0 and Color 1.
Click on Post Command to Update Tally Colors, it will create a new tally (TestTally_new) along with code 200 if the response is successful.
The API used here is POST :http://<ip_address:port>/api/5.0/tally/command/.json
Shutdown Buttons
This example can be used to shut down multiple MCMs, from a single location.
Copy the HTML code from here and run the HTML file. Enter the username and password, and the MCM IP’s that needs to be shut down.
Click on Shutdown, it will shut down all the MCMs along with code 200 if the response is successful.
The API used here is POST :http://<ip_address:port>/api/2.0/devices/command/shutDown/.json