Flussonic Media Server documentation

Flussonic JSON API

JSON API Anchor Anchor x2

Flussonic offers a single way to get a configuration (possibly with runtime status) of server with stream, files, etc and update it in the same way.

It is done via JSON API that sends well known structure from server and to server.

Fetching server configuration Anchor Anchor x2

All requests to Flussonic are made via HTTP/HTTPS with basic authentication from edit_auth option.

Call:

curl http://admin:password@flussonic:8080/flussonic/api/read_config

You can specify some query string parameters:

  • @skip_streams=true@ this option will remove static streams from output, sending you only moderate amount of configuration
  • @runtime=true@ this option will fill configuration structure with runtime statistics

Adding runtime=true is enough to render a Flussonic admin page.

curl http://admin:password@flussonic:8080/flussonic/api/read_config?runtime=true

You will get following structure from flussonic:

{
    "edit_auth": {
        "login": "admin",
        "password": "password"
    },
    "http": [
        8080
    ],
    "root": "wwwroot",
    "rtmp": 1935,
    "streams": {
        "clock": {
            "auth": {
                "url": "priv/auth.lua",
                "url_orig": "priv/auth.lua"
            },
            "dvr": {
                "disk_limit": 120,
                "dvr_limit": 10368000,
                "root": "movies"
            },
            "name": "clock",
            "position": 1,
            "static": true,
            "urls": [
                {
                    "url": "fake://fake"
                }
            ]
        }
    }
    "lives": {
        "published": {
            "auth": {},
            "position": 1,
            "prefix": "published",
            "publish_enabled": true,
            "static": false
        }
    }
   "vods": {
        "vod": {
            "auth": {},
            "position": 1,
            "prefix": "vod",
            "urls": [
                {
                    "url": "priv"
                }
            ]
        }
    }
}

Here on top level you have global config options and in streams, vods, lives, dynamics, sources you get list of entries, represented as an object with values as objects with "position" key.

Creating/modifying stream Anchor Anchor x2

How to modify stream with such method?

Post the same json to http://flussonic:8080/flussonic/api/modify_config

curl -d '{"streams" : {"clock2" : {"static" : true, "urls" : [{"url" : "fake://fake"}]}}}' http://admin:password@flussonic:8080/flussonic/api/modify_config

Flussonic will merge your definition with existing. If you already have a stream, its configuration will be deep merged with what you have sent.

How to delete a stream?

curl -d '{"streams" : {"clock2" : null}}' http://admin:password@flussonic:8080/flussonic/api/modify_config

The same (sending null or undefined as a value) may be done with each configuration value.