Rest API - Storm Server

The Rest API makes it possible to retrieve basic information from the server and also to call some functions. Before we can access the API, it must be configured properly via the preferences.xml file

                        
<REST>
    <IPWhiteList>192.168.0.1, 192.168.0.2</IPWhiteList>
</REST>
                        

IPWhiteList can contain multiple IP addresses separated by comma (space is optional). If a requesting agent is not included on the list the following message will be returned:

                        
{status:"fail", reason:"unknown agent"}
                    

API available

Below you’ll find a list of available APIs for basic server management.

  1. Get server version

    GET: /rest-api/get-version

                                        
    {
        version: "1.0.3",  // server version
        branch: "main"   // server branch (usually main or development)
    }
                                    
  2. Get server load

    GET: /rest-api/get-load

                                        
    {
        cpuLoad: 4,            // CPU usage in %
        heapSize: 342134,     // Total number of memory in MB taken by Java VM
        usedMemory: 23131,    // Memory used by the server
        freeMemory: 341580    // Free memory
    }
                                    
  3. Get statistics

    GET: /rest-api/get-statistics

                                        
    {
        streams: 100,    // Number of streams
        viewers: 10000,  // Number of viewers
        uptime: 3600     // Number of seconds since player start
    }
                                    
  4. Server restart

    GET: /rest-api/restart-server

                                        
    {
        command: "restart",     // Command name
        status: "success"       // Action status
    }
                                    
  5. Server shutdown

    GET: /rest-api/shutdown-server

                                        
    {
        command: "shutdown",     // Command name
        status: "success"       // Action status
    }
    
                                    
  6. Register group

    POST: /rest-api/register-group

    Post fields:

    commandregisterStreamGroup
    groupNameA name for a group Name. For more reference please check Gateway configuration section.
    dataJSON source array. For more reference please check Gateway server section.
                                        
    {
        command: "registerStreamGroup",     // Command name
        status: "success"       // Action status
    }
    
                                    
  7. Unregister group

    POST: /rest-api/unregister-group

    Post fields:

    commandunregisterStreamGroup
    groupNameA name for a group Name. For more reference please check Gateway configuration section.
                                        
    {
        command: "unregisterStreamGroup",     // Command name
        status: "success"       // Action status
    }