HOW TO: Control OnTheAir CG Server with the REST API


You have 2 options with our APIs:

  1. Using the REST api: You would be regularly polling the projects to know their status. 
  2. Using the WebSockets: Instead of polling, you will be pushed notifications when changes happen.  

All the objects received from our API are in JSON.

Using the REST API

The best way to get the most up to date documentation (and the one for your specific version of OnTheAir CG) for the OnTheAir CG REST API is to start the OnTheAir CG Server application on a Mac, and then simply type in a browser on that Mac:


This will return a page with all the explanations and calls that can be made.


Using Websockets

You can also have a look at the sample webpages that we provide (they use websockets). Check the article about how to remotely control OnTheAir CG  to know how to install and configure the sample html pages.

You will have 2 sample html pages:

  • CG_SimpleControl.html
  • CG_TeamControl.html

You can already check the html code that we used. You will note that we use some JavaScript for the websockets, you can check the following javascript:

  • webSocket.js

Take a look where there is this code:

var webSocket = new WebSocket

We declare the socket we listen on and the protocol, see below for the 3 different WebSockets. On the line just under the WebSocket creation, we register a function for the onMessage event.

On each event, OnTheAir CG Server will push data onto the sockets and that will trigger that function. The data is always formatted as a JSON dictionary with a dataType key and the actual data is at the "data" key.
On the main socket, there will also be a "change" key so you know what happened (insertion, removal, update).

Please note that when you connect to main socket, all the data model of OnTheAir CG Server is pushed onto it in its current state.


Available WebSockets

There are 3 websockets available

v1.1.CGUpdates (path: update)
v1.1.CGProjectMainUpdates (path:  projects/UID/update)
v1.1.CGProjectRealTimeUpdates (path:  projects/UID/update)



This web socket is to be notified when projects are added or removed from OnTheAir CG Server:

  • remove project(s)
  • add project(s)



This websocket will notify about the project changes themselves:

  • add published item
  • remove published item
  • published item property changed
  • project reverted
  • project Status changed
  • metadata changed


This websocket is for the elapsed time changes (so you can indicate where the project is currently playing).

Have more questions? Submit a request