Wowza Community

Error while creating application with rest api for wse-rest-library-php

I’m trying to create a simple app using the RestAPI in wse-rest-library-php, but I’m getting an error. Please refer to the code and error log below.

PHP Version 7.4.9

PHP Code

use Com\Wowza\Entities\Application\Helpers\Settings;
use Com\Wowza\Entities\Application\StreamConfig;
use Com\Wowza\Application;

$setup = new Settings();
$setup->setHost('http://localhost:8087/v2');
$setup->setUsername('username'); //ex
$setup->setPassword('password'); //ex

$application = new Application($setup, 'test2live');
$streamingConfig = new StreamConfig();
$streamingConfig->setStreamType('live');
$streamingConfig->setURI($this->_application->getRestURI());
$streamingConfig->setLiveStreamPacketizer(['sanjosestreamingpacketizer', 'cupertinostreamingpacketizer']);

$response = $application->create($streamingConfig);
echo('<pre>');
var_dump($response);
echo('</pre>');

RESPONSE

{
  ["message"]=>
  string(93) "The server encountered an unexpected condition which prevented it from fulfilling the request"
  ["success"]=>
  bool(false)
  ["wowzaServer"]=>
  string(5) "4.8.0"
  ["code"]=>
  string(3) "500"
}

ERROR LOG:

{
  ["message"]=>
  string(93) "The server encountered an unexpected condition which prevented it from fulfilling the request"
  ["success"]=>
  bool(false)
  ["wowzaServer"]=>
  string(5) "4.8.0"
  ["code"]=>
  string(3) "500"
}

Sorry. The error code was entered incorrectly.

class com.wowza.wms.rest.vhosts.applications.ApplicationConfig.post : java.lang.IllegalArgumentException: argument "src" is null|at com.fasterxml.jackson.databind.ObjectReader._assertNotNull(ObjectReader.java:2120)|at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1224)|at org.restlet.ext.jackson.JacksonRepresentation.getObject(JacksonRepresentation.java:309)|at com.wowza.wms.rest.ConfigBase.getObject(ConfigBase.java:2784)|at com.wowza.wms.rest.ConfigBase.post(ConfigBase.java:3577)|

Hi @Takashi Sudo

I would recommend you create an issue on the repo. There is also a develop branch that is community maintained that may help solve your issue as well.