728x90

You can use the Wowza Streaming Engine™ REST API to create and manage applications in Wowza Streaming Engine media server software. This Quick Start article shows how to use cURL to query the REST API to create and manage a live streaming application.

Notes:

Contents


Create an application
Update an application's settings
Add custom properties to an application
Restart an application
Get a list of applications

Create an application


Create an application (named testlive) for live streaming with Wowza Streaming Engine default settings:

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 -d'
{
   "restURI": "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive",
   "name": "testlive",
   "appType": "Live",
   "clientStreamReadAccess": "*",
   "clientStreamWriteAccess": "*",
   "description": "A basic live application",
   "streamConfig": {
      "restURI": "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/streamconfiguration",
      "streamType": "live"
   }
}
'

The command should return a response that looks something like this:

{
   "success": true,
   "message": "Application (testlive) created successfully."
}

You could also create the application testlive with password authentication by adding securityConfig and ModuleCoreSecurity to the 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 -d'
{
   "restURI": "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive",
   "name": "testlive",
   "appType": "Live",
   "description": "A live application with password authentication",
   "streamConfig": {
      "restURI": "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/streamconfiguration",
      "streamType": "live"
   },
   "securityConfig": {
      "restURI": "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/security",
      "secureTokenVersion": 0,
      "clientStreamWriteAccess": "*",
      "publishRequirePassword": true,
      "publishPasswordFile": "",
      "publishRTMPSecureURL": "",
      "publishIPBlackList": "",
      "publishIPWhiteList": "",
      "publishBlockDuplicateStreamNames": false,
      "publishValidEncoders": "",
      "publishAuthenticationMethod": "digest",
      "playMaximumConnections": 0,
      "playRequireSecureConnection": false,
      "secureTokenSharedSecret": "",
      "secureTokenUseTEAForRTMP": false,
      "secureTokenIncludeClientIPInHash": false,
      "secureTokenHashAlgorithm": "",
      "secureTokenQueryParametersPrefix": "",
      "secureTokenOriginSharedSecret": "",
      "playIPBlackList": "",
      "playIPWhiteList": "",
      "playAuthenticationMethod": "none"
   },
   "modules": {
      "restURI": "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/modules",
      "moduleList": [{
          "order": 0,
          "name": "base",
          "description": "Base",
          "class": "com.wowza.wms.module.ModuleCore"
      }, {
         "order": 1,
          "name": "logging",
          "description": "Client Logging",
          "class": "com.wowza.wms.module.ModuleClientLogging"
      }, {
          "order": 2,
          "name": "flvplayback",
          "description": "FLVPlayback",
          "class": "com.wowza.wms.module.ModuleFLVPlayback"
      }, {
          "order": 3,
          "name": "ModuleCoreSecurity",
          "description": "Core Security Module for Applications",
          "class": "com.wowza.wms.security.ModuleCoreSecurity"
      }]
   }
}
'

Here's how you would create the application testlive with password authentication and three live stream packetizers enabled:

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 -d'
{
   "restURI": "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive",
   "name": "testlive",
   "appType": "Live",
   "description": "A live application with password authentication and packetizers",
   "streamConfig": {
      "restURI": "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/streamconfiguration",
      "streamType": "live",
     "liveStreamPacketizer": [
         "cupertinostreamingpacketizer",
         "smoothstreamingpacketizer",
         "sanjosestreamingpacketizer"
      ]
   },
   "securityConfig": {
      "restURI": "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/security",
      "secureTokenVersion": 0,
      "clientStreamWriteAccess": "*",
      "publishRequirePassword": true,
      "publishPasswordFile": "",
      "publishRTMPSecureURL": "",
      "publishIPBlackList": "",
      "publishIPWhiteList": "",
      "publishBlockDuplicateStreamNames": false,
      "publishValidEncoders": "",
      "publishAuthenticationMethod": "digest",
      "playMaximumConnections": 0,
      "playRequireSecureConnection": false,
      "secureTokenSharedSecret": "",
      "secureTokenUseTEAForRTMP": false,
      "secureTokenIncludeClientIPInHash": false,
      "secureTokenHashAlgorithm": "",
      "secureTokenQueryParametersPrefix": "",
      "secureTokenOriginSharedSecret": "",
      "playIPBlackList": "",
      "playIPWhiteList": "",
      "playAuthenticationMethod": "none"
   },
   "modules": {
      "restURI": "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/modules",
      "moduleList": [{
          "order": 0,
          "name": "base",
          "description": "Base",
          "class": "com.wowza.wms.module.ModuleCore"
      }, {
          "order": 1,
          "name": "logging",
          "description": "Client Logging",
          "class": "com.wowza.wms.module.ModuleClientLogging"
      }, {
          "order": 2,
          "name": "flvplayback",
          "description": "FLVPlayback",
          "class": "com.wowza.wms.module.ModuleFLVPlayback"
      }, {
          "order": 3,
          "name": "ModuleCoreSecurity",
          "description": "Core Security Module for Applications",
          "class": "com.wowza.wms.security.ModuleCoreSecurity"
      }]
   }
}
'

Update an application's settings


Update the application testlive to include the MPEG-DASH packetizer:

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 -d'
{
  "restURI": "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive",
  "name":" testlive",
  "appType": "Live",
  "streamConfig": {
      "restURI": "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/streamconfiguration",
      "streamType": "live",
      "liveStreamPacketizer": [
         "cupertinostreamingpacketizer",
         "smoothstreamingpacketizer",
         "sanjosestreamingpacketizer",
         "mpegdashstreamingpacketizer"
      ]
  }
}
'

The command should return a response that looks something like this:

{
  "success": true,
  "message": "Saved"
}

Add custom properties to an application


Update the testlive application to include a custom module called MyCustomModule:

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/adv -d'
{
   "restURI": "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/adv",
   "version": "1430682096000",
   "modules": [{
       "order": 0,
       "name": "base",
       "description": "Base",
       "class": "com.wowza.wms.module.ModuleCore"
   }, {
       "order": 0,
       "name": "logging",
       "description": "Client Logging",
       "class": "com.wowza.wms.module.ModuleClientLogging"
   }, {
       "order": 0,
       "name": "flvplayback",
       "description": "FLVPlayback",
       "class": "com.wowza.wms.module.ModuleFLVPlayback"
   }, {
       "order": 0,
       "name": "ModuleDRMVerimatrix",
       "description": "ModuleDRMVerimatrix",
       "class": "com.wowza.wms.drm.module.verimatrix.ModuleDRMVerimatrix"
   }, {
       "order": 0,
       "name": "ModuleDRMBuyDRM",
       "description": "ModuleDRMBuyDRM",
       "class": "com.wowza.wms.drm.module.buydrm.ModuleDRMBuyDRM"
   }, {
       "order": 0,
       "name": "ModulePushPublish",
       "description": "Module Push Publish",
       "class": "com.wowza.wms.pushpublish.module.ModulePushPublish"
   }, {
       "order": 0,
       "name": "MyCustomModule",
       "description": "Module Custom Module",
       "class": "com.my.custom.path.MyCustomModule"
   }],
   "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": "myCustomPropertyName",
       "value": "myValue",
       "defaultValue": null,
       "type": "String",
       "sectionName": "Application",
       "section": "/Root/Application",
       "documented": false
   }]
}
'

The result is that your application's configuration includes the following custom modules and properties:

<Modules>
	<Module>
		<Name>base</Name>
		<Description>Base</Description>
		<Class>com.wowza.wms.module.ModuleCore</Class>
	</Module>
	<Module>
		<Name>logging</Name>
		<Description>Client Logging</Description>
		<Class>com.wowza.wms.module.ModuleClientLogging</Class>
	</Module>
	<Module>
		<Name>flvplayback</Name>
		<Description>FLVPlayback</Description>
		<Class>com.wowza.wms.module.ModuleFLVPlayback</Class>
	</Module>
	<Module>
		<Name>ModuleDRMVerimatrix</Name>
		<Description>ModuleDRMVerimatrix</Description>
		<Class>com.wowza.wms.drm.module.verimatrix.ModuleDRMVerimatrix</Class>
	</Module>
	<Module>
		<Name>ModuleDRMBuyDRM</Name>
		<Description>ModuleDRMBuyDRM</Description>
		<Class>com.wowza.wms.drm.module.buydrm.ModuleDRMBuyDRM</Class>
	</Module>
	<Module>
		<Name>ModulePushPublish</Name>
		<Description>Module Push Publish</Description>
		<Class>com.wowza.wms.pushpublish.module.ModulePushPublish</Class>
	</Module>
	<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>

Restart an application


Restart the application testlive:

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

Get a list of applications


Get a list of all applications on an instance of Wowza Streaming Engine:

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

The command should return a response that looks something like this:

{
   "restURI": "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications",
   "applications": [{
      "id": "live",
      "href":"http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live",
      "appType": "Live",
      "dvrEnabled": false,
      "drmEnabled": false,
      "transcoderEnabled": false
   }, {
      "id": "vod",
      "href": "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/vod",
      "appType": "VOD",
      "dvrEnabled": false,
      "drmEnabled": false,
      "transcoderEnabled": false
   }]
}

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

+ Recent posts