Wowza Streaming Engine™ 4.3 or later media server software includes a RESTful Application Programming Interface (API) that you can use to configure, manage, and monitor a media server through Hypertext Transfer Protocol (HTTP) requests. Two common query languages to use to execute HTTP requests are cURL and PHP.
Query the REST API using cURL
Query the REST API using PHP
The format for cURL requests to the Wowza Streaming REST API is:
curl -X [METHOD] [Headers] http://[your-wowza-server]:8087/v2/[path-to-resource]
Headers are information that precede the actual HTTP request. The Wowza Streaming Engine REST API requests in our examples use the Accept, Content-Type, and charset headers as follows:
--header 'Accept:application/json; charset=utf-8' --header 'Content-Type:application/json; charset=utf-8'
The Accept and Content-Type headers instruct the requests and responses to use JSON syntax. The charset header specifies that the requests and responses use UTF-8 character encoding.
If you prefer to use XML syntax, change the headers to:
--header 'Accept:application/xml; charset=utf-8' --header 'Content-Type:application/xml; charset=utf-8'
The HTTP method is the action you're requesting of the resource. The Wowza Streaming Engine REST API uses four cURL methods, or commands:
- GET - Obtain information from the resource.
- PUT - Update information or perform an action on an existing record.
- POST - Create a record.
- DELETE - Remove an existing record.
Parameters and properties can be used to refine the request. They generally correspond to options in the Wowza Streaming Engine Manager.
The resource is the HTTP location where you're sending the request. In the Wowza Streaming Engine REST API, the base resource is
Note: In our query examples, authentication is disabled in the Server.xml file:<AuthenticationMethod>none</AuthenticationMethod>
If you set the authentication method to digest, for example, you'll want to add that to the cURL request as follows:curl --digest -u "user:pass" -X [METHOD] [Headers] http://[your-wowza-server]:8087/v2/[path-to-resource]
You can wrap the Wowza Streaming Engine REST API with a custom PHP library to configure, manage, and monitor your server through PHP requests. First, download the PHP library from GitHub. Then, point the library to your streaming media server by modifying the following lines in include/constants.php as follows:
define("BASE_DIR", dirname(dirname(__FILE__))); define("WOWZA_HOST","http://localhost:8087/v2"); define("WOWZA_SERVER_INSTANCE", "_defaultServer_"); define("WOWZA_VHOST_INSTANCE", "_defaultVHost_"); define("WOWZA_USERNAME", "admin"); define("WOWZA_PASSWORD", "admin");
PHP query examples are available in the tests folder of the Wowza Streaming Engine PHP library download.
Reference documentation for the Wowza Streaming Engine REST API is available by using Swagger, and can be downloaded and installed locally. See How to access documentation for the Wowza Streaming Engine REST API.
If you're having problems or want to discuss this article, post in our forum.