Flussonic Media Server documentation

Changing the server configuration by passing JSON objects

You can modify the Flussonic settings by sending JSON objects in HTTP API calls.

Modifying the Flussonic configuration by passing JSON objects (modify_config) Anchor Anchor x2

The modify_config command is a part of the HTTP API and it allows you to edit fragments of the Fussonic configuration file and save the changes on disk.

Request's URL: /flussonic/api/modify_config


  • HTTP request payload (required parameter) — a JSON object that contains the part of configuration with which you want to replace an existing part or which you want to add to the configuration.

Response: Entire updated configuration in the JSON format.

You pass a configuration in the form of JSON to the API. The passed configuration is merged with the working one on the server, and the result is saved to the configuration file /etc/flussonic / flussonic.conf.

Note that only the difference between the old config and the new one is transmitted.

The fields in the transmitted JSON object correspond to the parameters specified in the text file with the configuration. Groups of objects, such as streams and publication prefixes, are grouped within the streams and lives fields. Some parameters have values that are also objects, not strings.

To delete a parameter, set it to null.

How to specify parameters in JSON correctly

To know how a certain configuration parameter is written in the JSON format, you can get Flussonic configuration in JSON by using this API. Learn more in read_config.

Example. Authorization

Suppose the global authorization is turned on in Flussonic, we have an HTTP backend with a passed parameter secret=xyz:

auth http://localhost:4567/auth secret=xyz;

We want to use the script myscript.lua instead, and to pass another parameter mykey=123 in addition to secret=xyz. To modify the configuration accordingly, use this JSON object in a call:

{"auth": {"url": "myscript.lua", "extra": {"mykey": "123"}}}

As a result, the configuration file will have this line:

auth myscript.lua mykey=123 secret=xyz;

To turn off authorization, pass {"auth": null}.

Example. Actions with streams

You can access a sream settings via the field "streams", to which you pass an object that contains stream infromation. The stream name acts as the key.

For example, let's turn off authorization for the stream channel_01. To do so, specify false for URL:

'{"streams": {"channel_01": {"auth": {"url": false}}}}'

Flussonic will write the value false for the auth directive in the configuration file:

stream channel_01 {
   url hls://myvideo.com/mylive;
   auth false;

A stream can have several sources. Several sources are specified by using the array urls:

    {"urls": [{"url": "tshttp://example.com/mystream"},
              {"url": "udp://"}

How to delete a stream:

'{"streams" : {"channel_01" : null}}'

And this is the example of the same request to delete a stream, posted by using curl :

curl -d '{"streams" : {"test1" : null}}' http://ADMIN:PASSWORD@FLUSSONIC:8080/flussonic/api/modify_config