Wowza Community

Creating SMIL files using REST API


I’m trying to create a smil file using the Wowza REST API. I can successfully create it using the Wowza Streaming Engine REST API Documentation Server but not with Postman or PHP cURL requests.

I can create a stream file using both Postman and PHP without a problem, but when I try to create a smil file I get the error “The server encountered an unexpected condition which prevented it from fulfilling the request”.

Any ideas on how to solve this would be greatly appreciated.

Hi @Emily Cambridge, sorry for your issues with this. Did you already follow this Wowza doc to create the SMIL file with PHP? I know you said you can create a stream file, but trying to rule out some things first.

I’ll share your screenshots with tech support and see if they can quickly identify the issue. They may need you to submit a support ticket to take a closer look at your files. I will let you know. Thanks.

Hi guys, I got it working a few days later but I neglected to put an update here… I was basically just excluding some info, which I found later from the following link:

I’ve included an excerpt of my PHP code below:

##### Adding the smil file
 $url = "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/smilfiles/apiTest";
 $target = array(
 "restURI" => "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/smilfiles/apiTest",
 "title" => "apiTest",
 "smilStreams" => [ array(
 "src" => "",
 "type" => "video",
 "systemLanguage" => "en",
 "videoBitrate" => "1000000",
 "audioBitrate" => "160000",
 "restURI" => "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/smilfiles/apiTest"
 $json = json_encode($target);
 $ch = curl_init();
 curl_setopt_array($ch, array(
 CURLOPT_URL => $url,
 CURLOPT_POST => true,
 CURLOPT_USERPWD => "admin:admin",
 curl_setopt($ch, CURLOPT_HTTPHEADER, array(
 'Accept:application/json; charset=utf-8',
 'Content-type:application/json; charset=utf-8',
 'Content-Length: '.strlen($json)));
 $contents = curl_exec($ch);
 $ch = curl_init();
 $obj =  json_decode($contents);

That’s really nice of you to return and update the forums for others. Glad you got it working @Emily Cambridge!