RESTful API - Stream Management - Storm Streaming Server

This section describes Storm’s RESTful API regarding server basic functionality and information.

Get stream info

Request typeGET
URL/rest-api/applications/${APPLICATION_NAME}/${STREAM_NAME}
AnswerHTTP/1.1 200 OK
Content-Type: application/json

{
   "status":"success",
   "data":{
      "streamName":"live",
      "connections":10,
      "download":15400,
      "upload":681231,
      "startDate":1685526733,
      "state":"running",
      "sourceType":"RTMP_SERVER"
   }
}
                                        
Table 1. Get stream info table

Field explanation:

streamNameStream name
connectionsNumber of viewer connections.
downloadDownload speed for this application (all incoming streams).
uploadUpload speed for this application (all viewer connections).
startDateStart date for this application in Unix time.
stateCurrent state of the stream. Possible values:

INITIALIZED – stream has been just initialized,
RUNNING – stream is running,
HIBERNATED – stream is hibernated,
CLOSED – stream is closed and it’s about to be removed,
CLOSING – stream is being closed
sourceTypeType of source: Possible values:

RTMP_SERVER – stream was pushed to the server
RTMP_CLIENT – stream was pulled from different RTMP server
Table 2. Get stream info fields table

Delete stream

Request typeDELETE
URL/rest-api/applications/${APPLICATION_NAME}/${STREAM_NAME}
AnswerHTTP/1.1 200 OK
Content-Type: application/json

{
   "status":"success",
   "data":{
      "command":"delete"
   }
}
                                        
Table 3. Delete stream table

Field explanation:

commandRepeats command from Request Data.
Table 4. Delete stream fields table

Disconnect viewers

Request typePUT
Request Data

{
   "command":"disconnectAll"
}
                                        
URL/rest-api/applications/${APPLICATION_NAME}/${STREAM_NAME}
AnswerHTTP/1.1 200 OK
Content-Type: application/json

{
   "status":"success",
   "data":{
      "command":"disconnectAll"
   }
}
                                        
Table 5. Disconnect viewers table

Field explanation:

commandRepeats command from Request Data.
Table 6. Disconnect viewers fields table

Rename stream

Request typePUT
Request Data

{
   "command":"rename",
   "data":{
      "newStreamName":"$NEW_STREAM_NAME"
   }
}
                                        
URL/rest-api/applications/${APPLICATION_NAME}/${STREAM_NAME}
AnswerHTTP/1.1 200 OK
Content-Type: application/json

{
   "status":"success",
   "data":{
      "command":"disconnectAll"
   }
}
                                        
Table 7. Rename stream table

Field explanation:

commandRepeats command from Request Data.
newStreamNameNew name for the stream.
Table 8. Rename stream fields table

Copy stream

Request typePUT
Request Data

{
   "command":"copy",
   "data":{
      "copyStreamName":"$NEW_STREAM_NAME",
      "targetApplication":"edge"
   }
}
                                        
URL/rest-api/applications/${APPLICATION_NAME}/${STREAM_NAME}
AnswerHTTP/1.1 200 OK
Content-Type: application/json

{
   "status":"success",
   "data":{
      "command":"disconnectAll"
   }
}
                                        
Table 9. Copy stream table

Field explanation:

commandRepeats command from Request Data.
copyStreamNameName of a copied stream.
targetApplicationName of application where copied stream should be added.
Table 10. Copy stream table

Create stream

Request typePUT
Request DataFor push style stream:

{
   "command":"create",
   "data":{
      "streamName":"$STREAM_NAME",
      "type":"push",
      "authorization":{
         "username":"admin",
         "password":"qwerty"
      }
   }
}
                                        
For pull style stream:

{
   "command":"create",
   "data":{
      "streamName":"$STREAM_NAME",
      "type":"pull",
      "serverURL":"rtmp://somedomain.com/appName",
      "streamName":"test",
      "authorization":{
         "username":"admin",
         "password":"qwerty"
      }
   }
}
                                        
URL/rest-api/applications/${APPLICATION_NAME}
AnswerHTTP/1.1 200 OK
Content-Type: application/json

{
   "status":"success",
   "data":{
      "command":"disconnectAll"
   }
}
                                        
Table 11. Create stream table

Field explanation:

commandRepeats command from Request Data.
licenseTypeStream name
licenseTypePossible values:

push – for most popular broadcasters/encoders like obs, xsplit.
(server receives data)

pull – for pulling stream from a different RTMP-server.
serverURLOnly for “pull” type streams. Contains path to a RTMP server with application in following format:

“rtmp://”+hostname+”/”+applicationName
streamKeyStream key
authorizationContains authorization data for stream. For push-type stream publishing will be restricted to provided credentials or token. In case of pull-type stream credentials will be used for authenticating connection.

Possible variants:

1. Credentials:

"authorization":{
    "username":"admin",
   "password":"qwerty"
}
                                        
2. Token:

"authorization":{
   "token":"62cjdj"
}
                                        
Table 12. Create stream fields table

Restream stream

Request typePUT
Request Data

{
   "command":"restream",
   "data":{
      "serverURL":"rtmp://somedomain.com/appName",
      "streamName":"test",
      "authorization":{
         "username":"admin",
         "password":"qwerty"
      }
   }
}
                                        
URL/rest-api/applications/${APPLICATION_NAME}/${STREAM_NAME}
AnswerHTTP/1.1 200 OK
Content-Type: application/json

{
   "status":"success",
   "data":{
      "command":"disconnectAll"
   }
}
                                        
Table 13. Restream stream table

Field explanation:

commandRepeats command from Request Data.
serverURLOnly for “pull” type streams. Contains path to a RTMP server with application in following format:

“rtmp://”+hostname+”/”+applicationName
streamKeyStream name
authorizationContains authorization data for stream. Possible variants:

1. Credentials:

"authorization":{
    "username":"admin",
   "password":"qwerty"
}
                                        
2. Token:

"authorization":{
   "token":"62cjdj"
}
                                        
Table 14. Restream stream fields table