application management query examples
Create a live app
The first step to using Wowza Streaming Engine™ media server software is to create a live streaming application. This article demonstrates how to create and manage a streaming app using the Wowza Streaming Engine (WSE) REST API.
Prerequisites
WSE 4.3.0 or later
Create an app
To create a new live app, send a POST request to the create app endpoint. Authenticate the request with your username and password. Include the app name as a path parameter and set the appType to Live in the body of the request. In the example below, we create a new live app called myLiveApp.
Example cURL request
curl -X POST \
-H 'Accept:application/json; charset=utf-8' \
-H 'Content-Type:application/json; charset=utf-8' \
http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/myLiveApp \
-u {username}:{password} \
-d '\n {\n "restURI": "http://localhost:8087/v2/servers/{serverName}/vhosts/{vhostName}/applications/myLiveApp",
"name": "testlive",
"appType": "Live",
"clientStreamReadAccess": "*",
"clientStreamWriteAccess": "*",
"description": "A basic live application",
"streamConfig": {
"restURI": "http://localhost:8087/v2/servers/{serverName}/vhosts/{vhostName}/applications/testlive/streamconfiguration",
"streamType": "live"
}
}'
Example 201 response
{
"success": true,
"message": "Application (myLiveApp) created successfully."
}
Add password authentication
To create a live password-authenticated app, send a POST request to the create app endpoint. Include the app name as a path parameter and the securityConfig object and the ModuleCoreSecurity module in the body of the request. The example below creates a new live app called secureLiveApp.
Example cURL request
curl -X POST \
-H 'Accept:application/json; charset=utf-8' \
-H 'Content-Type:application/json; charset=utf-8' \
http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/secureLiveApp \
-u {username}:{password} \
-d '{\n "appType": "Live",\n "securityConfig": {\n "clientStreamWriteAccess" : "*",\n "publishRequirePassword": true,\n "publishAuthenticationMethod": "digest"\n },\n "modules": {\n "moduleList": [\n {\n "order": 0,\n "name": "ModuleCoreSecurity",\n "description": "Core Security Module for Applications",\n "class": "com.wowza.wms.security.ModuleCoreSecurity"\n }\n ]\n }\n }'
Example 201 response
{
"success": true,
"message": "Application (secureLiveApp) created successfully."
}
Enable live stream packetizer
To create a live-stream app, send a POST request to the create app endpoint. Include the app name as a path parameter and the streamConfig object in the body of the request. The example below creates a new app called liveStreamApp using the cupertinostreamingpacketizer live-stream packetizer.
Example request
curl -X POST \
-H 'Accept:application/json; charset=utf-8' \
-H 'Content-Type:application/json; charset=utf-8' \
http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/liveStreamApp \
-u {username}:{password} \
-d'\n {\n "name": "testlive",\n "appType": "Live",\n "description": "A live application with password authentication and packetizers",\n "streamConfig": {\n "streamType": "live",\n "liveStreamPacketizer": [\n "cupertinostreamingpacketizer"\n ]\n },\n "securityConfig": {\n "secureTokenVersion": 0,\n "clientStreamWriteAccess": "*",\n "publishRequirePassword": true,\n "publishPasswordFile": "",\n "publishRTMPSecureURL": "",\n "publishIPBlackList": "",\n "publishIPWhiteList": "",\n "publishBlockDuplicateStreamNames": false,\n "publishValidEncoders": "",\n "publishAuthenticationMethod": "digest",\n "playMaximumConnections": 0,\n "playRequireSecureConnection": false,\n "secureTokenSharedSecret": "",\n "secureTokenUseTEAForRTMP": false,\n "secureTokenIncludeClientIPInHash": false,\n "secureTokenHashAlgorithm": "",\n "secureTokenQueryParametersPrefix": "",\n "secureTokenOriginSharedSecret": "",\n "playIPBlackList": "",\n "playIPWhiteList": "",\n "playAuthenticationMethod": "none"\n },\n "modules": {\n "moduleList": [\n {\n "order": 0,\n "name": "base",\n "description": "Base",\n "class": "com.wowza.wms.module.ModuleCore"\n }, {\n "order": 1,\n "name": "logging",\n "description": "Client Logging",\n "class": "com.wowza.wms.module.ModuleClientLogging"\n }, {\n "order": 2,\n "name": "flvplayback",\n "description": "FLVPlayback",\n "class": "com.wowza.wms.module.ModuleFLVPlayback"\n }, {\n "order": 3,\n "name": "ModuleCoreSecurity",\n "description": "Core Security Module for Applications",\n "class": "com.wowza.wms.security.ModuleCoreSecurity"\n }\n ]\n }\n }'
Example 201 response
{
"success": true,
"message": "Application (liveStreamApp) created successfully."
}
Retrieve app list
To retrieve a list of all existing applications send a GET request to the get app list endpoint.
Example request
curl -X GET \
-H 'Accept:application/json; charset=utf-8' \
http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications \
-u {username}:{password}
Example 200 response
{
"serverName": "_defaultServer_",
"applications": [\
{\
"id": "liveStreamApp",\
"href": "/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/liveStreamApp",\
"appType": "live",\
"dvrEnabled": false,\
"drmEnabled": false,\
"transcoderEnabled": false,\
"streamTargetsEnabled": false\
},\
{\
"id": "secureLiveApp",\
"href": "/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/secureLiveApp",\
"appType": "live",\
"dvrEnabled": false,\
"drmEnabled": false,\
"transcoderEnabled": false,\
"streamTargetsEnabled": false\
}\
]
}
Update an app
To update an existing application, send a PUT request to the update app endpoint. Include the name of the app to be updated as a path parameter and any updated settings in the body of the request. The example below updates the liveStreamApp application to include the MPEG-DASH packetizer.
Example request
curl -X PUT \
-H 'Accept:application/json; charset=utf-8' \
-H 'Content-Type:application/json; charset=utf-8' \
http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/liveStreamApp \
-d'\n {\n "name":" liveStreamApp",\n "appType": "Live",\n "streamConfig": {\n "streamType": "live",\n "liveStreamPacketizer": [\n "cupertinostreamingpacketizer",\n "mpegdashstreamingpacketizer"\n ]\n }\n }'
Example 200 response
{
"success": true,
"message": "Saved"
}
Add custom properties to an application
To add a custom module to an application, send a PUT request to the advanced update app endpoint. The example below updates the liveStreamApp application to include a custom module called MyCustomModule and a custom property called myCustomProperty.
Example request
curl -X PUT \
-H 'Accept:application/json; charset=utf-8' \
-H 'Content-Type:application/json; charset=utf-8' \
-u {username}:{password} \
http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/liveStreamApp/adv \
-d '{\n "version": "1430682096000",\n "modules": [\
{\
"class" : "com.wowza.wms.module.ModuleCore",\
"description" : "Base",\
"name" : "base",\
"order" : 0\
},\
{\
"class" : "com.wowza.wms.module.ModuleClientLogging",\
"description" : "Client Logging",\
"name" : "logging",\
"order" : 1\
},\
{\
"class" : "com.wowza.wms.module.ModuleFLVPlayback",\
"description" : "FLVPlayback",\
"name" : "flvplayback",\
"order" : 2\
},\
{\
"class" : "com.wowza.wms.security.ModuleCoreSecurity",\
"description" : "Core Security Module for Applications",\
"name" : "ModuleCoreSecurity",\
"order" : 3\
},\
{\
"class": "com.my.custom.path.MyCustomModule",\
"description": "Module Custom Module",\
"name": "MyCustomModule",\
"order": 4\
}\
],\
"advancedSettings": [\
{\
"enabled": false,\
"canRemove": true,\
"name": "debugAACTimecodes",\
"value": "false",\
"defaultValue": "false",\
"type": "Boolean",\
"sectionName": "cupertinostreamingpacketizer",\
"section": "/Root/Application/LiveStreamPacketizer",\
"documented": true\
},\
{\
"enabled": false,\
"canRemove": true,\
"name": "debugMP3Timecodes",\
"value": "false",\
"defaultValue": "false",\
"type": "Boolean",\
"sectionName": "cupertinostreamingpacketizer",\
"section": "/Root/Application/LiveStreamPacketizer",\
"documented": true\
},\
{\
"enabled": false,\
"canRemove": true,\
"name": "cupertinoChunkDurationTarget",\
"value": "0",\
"defaultValue": "10000",\
"type": "Integer",\
"sectionName": "cupertinostreamingpacketizer",\
"section": "/Root/Application/LiveStreamPacketizer",\
"documented": true\
},\
{\
"enabled": true,\
"canRemove": false,\
"name": "myCustomProperty",\
"value": "myValue",\
"defaultValue": null,\
"type": "String",\
"sectionName": "Application",\
"section": "/Root/Application",\
"documented": false\
}\
]\
}'
A successful request will update your app's Application.xml file to include the custom modules and properties shown below.
Application.xml snippet
<Modules>
<Module>
<Name>MyCustomModule</Name>
<Description>Module Custom Module</Description>
<Class>com.my.custom.path.MyCustomModule</Class>
</Module>
</Modules>
<!-- Properties defined here will be added to the IApplication.getProperties() and IApplicationInstance.getProperties() collections -->
<Properties>
<Property>
<Name>myCustomPropertyName</Name>
<Value>myValue</Value>
<Type>String</Type>
</Property>
</Properties>
Delete an app
To delete an existing application, send a DELETE request to the delete app endpoint. Include the name of the app to be deleted as a path parameter and any updated settings in the body of the request. The example below deletes the liveStreamApp application.
Example request
curl -X DELETE \
-H 'Accept:application/json; charset=utf-8' \
-H 'Content-Type:application/json; charset=utf-8' \
-u {username}:{password} \
http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/liveStreamApp
Example 200 response
{
"success": true,
"message": "Application (liveStreamApp) deleted successfully"
}
Start, shutdown, restart or copy an app
With the application action endpoint you can start, shutdown, restart or copy an existing application.
Example request
curl -X PUT \
-H 'Accept:application/json; charset=utf-8' \
http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/liveStreamApp/actions/restart \
-u {username}:{password}