REST API - Creating an application works but can't stream until I manually restart the application

Title says it all. I can create an application and I can send an incoming stream to the rtmp url just fine. But I can’t get outgoing playback to work (404 not found) until I log into the UI (enginemanager) re-save the settings (without changing them) and restarting the application. Only after the save and restart will HLS playback start loading.

My php code that successfully creates the application:

            $url = "http://$publicIpAddress:8087/$this->wowzaEngineUrlPart/$siteName";
                $data = [
                    'restURI' => "http://$publicIpAddress:8087/$this->wowzaEngineUrlPart/$siteName/",
                    "name" => $siteName,
                    "appType" => "Live",
                    "clientStreamReadAccess" => "*",
                    "clientStreamWriteAccess" => "*",
                    "clientStreamWriteAccess" => "*",
                    "description" => "A basic live application",
                    "httpCORSHeadersEnabled" => true,
                    "streamConfig" => [
                      "restURI" => "http://$publicIpAddress:8087/$this->wowzaEngineUrlPart/$siteName/streamconfiguration/",
                      "streamType" => "live",
                    ],
                ];
                // use key 'http' even if you send the request to https://...
                $options = [
                    'http' => [
                        'header' => "Accept:application/json; charset=utf-8\r\n".
                                    "Content-Type:application/json; charset=utf-8\r\n",
                        'method' => 'POST',
                        'content' => json_encode($data),
                        'timeout' => 60,
                    ]
                ];

                $context  = stream_context_create($options);
                $result = file_get_contents($url, false, $context);
                if ($result === FALSE) { /* Handle error */ }

You can use this to restart @Matt Holmes:

curl -X PUT \
-H 'Accept:application/json; charset=utf-8' \
[http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/actions/restart](http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive/actions/restart)

More query examples here:

https://www.wowza.com/docs/application-management-query-examples

So is a restart supposed to be needed after a create call? If so why does the incoming stream work but the outgoing stream fail?

It sometimes has to do with outgoing packetizers being specified or not or custom properties when creating an application and those changes need to be saved in order for the packetizers/playback to work properly.