CasparCG Client (GET & POST)

Can you tell me how to use the command http GET request and http POST request in client?

If you have a sample file, please share it.HTTP_GETHTTP_POST

2 Likes

I know this was posted long time ago but I can’t find any guide for http post. What are the odds of you learning how to do it and still remembering it?

The client http get and post are just tools an operator can use to effect control of another device. We can illustrate their use via three modes of operation.

1) Equipment with REST style http control available.
We can illustrate this mechanism using the API interface offered by AJA KiPro record/replay units such as the Ki Pro GO. The API documentation is availalbe on line at:

Assume there is a Ki Pro unit on a control network using IP address 192.168.42.201, hence exposing a REST interface at http://192.168.42.201/config. This address is followed by a query string that has the detail of the command to execute. The query string has multiple entries called action , paramid and value. The query string to set the input to SDI is:

?action=set&paramid=eParamID_VideoInSelect&value=0

which is combined with the REST base address to give:

http://192.168.42.201/config?action=set&paramid=eParamID_VideoInSelect&value=0

The AJA documentation states that the input set action should be sent using a GET command. The CasparCG client HTTP GET tool allows the input selection to be entered as shown in the following screen grab.

The three keys and their values form the query part of the string.

Starting or stopping the transport uses a similar query structure, but the paramid value string used is eParamID_TransportCommand and the value key has a Value field of 1 for Play and 4 for Stop.

Other equipment with a REST style interface may specify the POST method rather than the GET method for the control command.

The transmission of the command, and the response from the server, are logged in the CasparCG Client log.

2) Using a User-Defined REST interface to Equipment
Assume we want to use the CasparCG client as our integrated control solution, but there is a device to be controlled that is not supported by the built-in control protocols.

We can implement a web-server using a technology such as NodeJS with two software interfaces - one to the equipment providing control via the published protocol, and one offering a REST style interface. Commands received by the REST interface are converted to the device specific protocol and sent to the controlled unit. We choose the address element (eg http://127.0.0.1:3000/control?) and a query string or strings of our design, choosing GET or POST as the delivery mechanism. These choices define the data entered in the GET or POST key/value fields in the client.

A small limitation of this approach is the control is essentially simplex. A command is sent to the web-server but the CasparCG client is not able to report issues such as the device being offline. This limitation may not be an issue when an operator is observing outputs.

This web-server intermediate process can be used for a wide range of equipment, including control of routing matricies.

3) Use a Web-Server to Control data displays in a CasparCG HTML Template
There are some graphics that need a large volume of data from a source to build the user display. Examples include sports event data such as competitors in swiming lanes, sports results, sports league tables, and weather forecasts. The web-server can open data routes to various external data sources, and parse data from the sources to an internal store or database.

The web server can also hold the template html, css and javascript code, serving these to the CasparCG server when the CG Play command runs using the web-server address as the source of the graphic. One of the early actions by the loaded template is opening a web-socket connection to the web-server providing a full-duplex communication channel for data requests from the template and display data sent by the server to the template.

There are multiple methods that can be used to move from one graphic display to the next. These include using the Client CG Update mechanism to send a display command string to the template which in turn asks the server for the data required for the selected display.

Alternately the web server can offer a REST style interface. We then use the client http GET or POST to send a command to the web-server which responds by pushing data to the display graphic.