API usage examples

    Counting the number of hls/http sessions:

    curl -s -X POST -d '{ "cmd": "sessions" }' http://login:pass@tv.server.ip:port/control/|grep client_id|wc -l
    

    Switching input:
    (For example , turning off the channel with erotic content in the daytime)

    curl -X POST -d '{"cmd":"set-stream-input", "id":"a006","input":2}' http://login:pass@tv.server.ip:port/control/
    

    Where:
    a006 - stream id, "input":2 - input number. The numbering of the inputs begins with one.


    Create user:

    curl -X POST -d '{"cmd": "set-user", "id": "user6541", "user": {"enable": true, "type": 3, "password": "user6541",  "conlimit": "5", "ip": "172.31.2.6", "packages": ["ALL"] }}' http://login:pass@tv.server.ip:port/control/
    

    Where:
    "id": "user6541" - User login. Is the user id.
    "enable": true - User is active.
    "type": 3 - User group. (1 - administrator, 2 - observer, 3 - user)
    "password": "user6541" - user password
    "conlimit": "5" - Limit on simultaneous connections.
    "ip": "172.31.2.6" - User's ip address.
    "packages": ["ALL"] - A package of channels available to the user.


    Get user configuration:

    curl -X POST  -d '{"cmd": "get-user", "id": "user6541"}' http://login:pass@tv.server.ip:port/control/
    

    Where:
    user6541 - user login.


    Create/edit stream:

    curl -X POST -d '{"cmd": "set-stream","id":"a005","stream": {"id": "a005","type": "spts","input": ["udp://251.34.21.5:1234"],"http_keep_active": "-1","name": "test","enable": true,"output": ["http://0:555/fox"]}}' http://login:pass@tv.server.ip:port/control/
    

    Where:
    "name":"test" - stream name
    "id": "a01h" - stream id