RESTful API - Stream Management - Storm Streaming Server

This section describes Storm’s RESTful API regarding stream creation and management.

Get Stream Info

Request type GET
URL /rest-api/applications/${APPLICATION_NAME}/${STREAM_NAME}
Answer HTTP/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:

streamName Stream name
connections Number of viewer connections.
download Download speed for this application (all incoming streams).
upload Upload speed for this application (all viewer connections).
startDate Start date for this application in Unix time.
state Current 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
sourceType Type 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 type DELETE
URL /rest-api/applications/${APPLICATION_NAME}/${STREAM_NAME}
Answer HTTP/1.1 200 OK
Content-Type: application/json

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

Field explanation:

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

Disconnect Viewers

Request type PUT
Request Data

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

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

Field explanation:

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

Rename Stream

Request type PUT
Request Data

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

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

Field explanation:

command Repeats command from Request Data.
newStreamName New name for the stream.
Table 8. Rename stream fields table.

Copy Stream

Request type PUT
Request Data

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

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

Field explanation:

command Repeats command from Request Data.
copyStreamName Name of a copied stream.
targetApplication Name of application where copied stream should be added.
Table 10. Copy stream table.

Create Stream

Request type PUT
Request Data For 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}
Answer HTTP/1.1 200 OK
Content-Type: application/json

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

Field explanation:

command Repeats command from Request Data.
streamName Stream name
type Possible values:

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

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

“rtmp://”+hostname+”/”+applicationName
streamKey Stream key
authorization Contains 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 type PUT
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}
Answer HTTP/1.1 200 OK
Content-Type: application/json

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

Field explanation:

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

“rtmp://”+hostname+”/”+applicationName
streamKey Stream name
authorization Contains authorization data for stream. Possible variants:

1. Credentials:

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

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

Create a free ticket and our support team will provide you necessary assistance.