Wowza Servers Application Management using REST-API

28 / Aug / 2016 by Tarun Saxena 0 comments

wowza-streaming-engine-horizontal-1024-1920x600

Wowza Streaming Engine is a streaming software utility which is developed by Wowza Media Systems. The utility is capable of streaming various types of videos and audio files on mobile, tablet and personal computer etc. The types of streaming videos include live video and on-demand streaming. It is basically a Java application which is supported on almost all types of operating systems.

Use Case
In this blog, I’ll be demonstrating the use of Wowza REST-API which can be used to automate the tasks on Wowza servers running in your application stack. The tasks include creating new application channels, copying existing channels to create new ones and deleting the non-required applications using command line as it is a bit tedious and repetitive task when performed from Wowza’s GUI. The tasks can be automated using shell scripts in any language.

Enabling Wowza REST-API
To enable Wowza REST-API in an existing Wowza server, go to the installation directory of Wowza [install_dir]/conf/Server.xml and add the following code snippet:

[js]
<RESTInterface>
<Enable>true</Enable>
<IPAddress>*</IPAddress>
<Port>8087</Port>
<!– none, basic, digest–>
<AuthenticationMethod>none</AuthenticationMethod>
<DiagnosticURLEnable>true</DiagnosticURLEnable>
<SSLConfig>
<Enable>false</Enable>
<KeyStorePath></KeyStorePath>
<KeyStorePassword></KeyStorePassword>
<KeyStoreType>JKS</KeyStoreType>
<SSLProtocol>TLS</SSLProtocol>
<Algorithm>SunX509</Algorithm>
<CipherSuites></CipherSuites>
<Protocols></Protocols>
</SSLConfig>
<IPWhiteList>*</IPWhiteList>
<IPBlackList></IPBlackList>
<EnableXMLFile>false</EnableXMLFile>
<DocumentationServerEnable>true</DocumentationServerEnable>
<DocumentationServerPort>8089</DocumentationServerPort>
<!– none, basic, digest–>
<DocumentationServerAuthenticationMethod>none</DocumentationServerAuthenticationMethod>
<Properties>
<Property>
<Name>restUserHTTPHeaders</Name>
<Value>Access-Control-Allow-Origin:*|Access-Control-Allow-Methods:OPTIONS,GET,PUT,DELETE,POST|Access-Control-Allow-Headers:Content-Type</Value>
</Property>
</Properties>
</RESTInterface>[/js]

Options which can be set from the above configuration:
1) Port: Port on which you want the REST-API to respond to the queries
2) Authentication Method: The authentication method to be used while accessing the REST-API interface
3) SSL Certificate: SSL setup for the REST-API (if required)
4) IP (Whitelist and Blacklist): To specifie the IP addresses from where we want to access/deny  the REST-API interface
5) Custom Headers: Custom headers to be used with REST-API

Note: After modifying the Server.xml configuration file in Wowza, there is a need to restart the Wowza Streaming Engine.

Important Commands For REST-API:

1) To get list of Wowza channels:

[js]
curl -X GET –header ‘Accept:application/json; charset=utf-8’ http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications
[/js]

2) To get the information of a single Wowza Application (Channel: live1)

[js]curl -X GET –header ‘Accept:application/json; charset=utf-8’ http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live1[/js]

 3) To create a single Wowza Application (Channel: live2)

[js]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/live2 –data @body.json [/js]

Note: In body.json, we can pass the JSON body of the application’s information. We can edit the output of the step 2 accordingly and use it to create a new channel.

4)   To delete a single Wowza Application (Channel: live2)

[js]curl -X DELETE –header ‘Accept:application/json; charset=utf-8’ http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live1 [/js]

By using the above documentation, you can automate the process of managing Wowza applications using customized scripts on multiple Wowza servers.

FOUND THIS USEFUL? SHARE IT

Leave a Reply

Your email address will not be published. Required fields are marked *