Stream management query examples for the Wowza Streaming Engine REST API

Use cURL to query the Wowza Streaming Engine™ media server software REST API to identify, add, and manage stream files in a Wowza Streaming Engine instance.

Notes:

Contents


Get a list of stream files
Add a stream file
Update a stream file
Connect a stream file
Disonnect a stream file
Remove a stream file

Get a list of stream files


The following example shows how to get a list of existing stream files (files with a .stream extension):
 
curl -X GET --header 'Accept:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/streamfiles

The expected response:

{"restURI":"http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/streamfiles","streamFiles":[{"id":"metallica","href":"http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/streamfiles/metallica"},{"id":"saosin","href":"http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/streamfiles/saosin"}]}

Similarly, to get a specific stream file configuration, you can use the following result:

curl -X GET --header 'Accept:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/streamfiles/metallica

An example result:

{"restURI":"http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/streamfiles/metallica","version":"1430317484000","uri":"rtmp://[wowza-server]:1935/[path-to-resource]"}

Add a stream file


To add a stream file, you can use the following request:

curl -X POST --header 'Accept:application/json; charset=utf-8' --header 'Content-type:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/streamfiles/axis -d'
{
   "restURI": "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/streamfiles",
   "streamFiles": [
      {
         "id": "connectAppName= testlive&appInstance=_definst_&mediaCasterType=rtp",
         "href": "http://localhohst:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/streamfiles/connectAppName=testlive&appInstance=_definst_&mediaCasterType=rtp"
      }
   ]
}'

Update a stream file


After you've initiated the stream file using the add stream file request, use the following request to define its parameters:

curl -X PUT --header 'Accept:application/json; charset=utf-8' --header 'Content-type:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/streamfiles/axis/adv -d'
{
"restURI": "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/streamfiles/axis/adv",
"version": "1430601267443",
"advancedSettings": [
{
"enabled": true,
"canRemove": true,
"name": "uri",
"value": "rtsp://user:pass@[ip-camera]:554/axis-media/media.amp?videocodec=h264&streamprofile=400",
"defaultValue": null,
"type": "String",
"sectionName": "Common",
"section": null,
"documented": true
},
{
"enabled": true,
"canRemove": true,
"name": "streamTimeout",
"value": "0",
"defaultValue": "12000",
"type": "Integer",
"sectionName": "Common",
"section": null,
"documented": true
},
{
"enabled": true,
"canRemove": true,
"name": "reconnectWaitTime",
"value": "0",
"defaultValue": "3000",
"type": "Integer",
"sectionName": "Common",
"section": null,
"documented": true
}
]
}'

Connect a stream file


Finally, initiate the stream file connection. You can do so by making a request for action to the stream file VHost path, as follows:

curl -X PUT --header 'Accept:application/json; charset=utf-8' --header 'Content-type:application/json; charset=utf-8' "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/streamfiles/metallica/actions/connect?connectAppName=testlive&appInstance=_definst_&mediaCasterType=rtp"

Disconnect a stream file


When you're done streaming and before you delete the stream file, you must disconnect it. You can do so with a request such as the following:

curl -X PUT --header 'Accept:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/incomingstreams/[stream_name].stream/actions/disconnectStream

Remove a stream file


When you're done with the stream file, you can delete it with the following request:

curl -X DELETE --header 'Accept:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/streamfiles/axis

Originally Published: 06-16-2015.
Updated: For Wowza Streaming Engine 4.6.0 on 01-03-2017.
 

If you're having problems or want to discuss this article, post in our forum.