This has been time consuming and frustrating but for my needs I think I’ve finally got this working. The logic of the API is lost on me and the documentation I could find is poor at best so hopefully this can help someone else in the future.
I am using some AXIS cameras and have set up .stream files for the various locations. The end users need to be able to turn start and stop the live streams from their webserver. To do this I had to first:
- Whitelist the IP address of the local server (for testing) and the remote server. Update the conf/Server.xml file something like this:
<IPWhiteList>127.0.0.1,192.168.100.*,100.60.100.6</IPWhiteList>
-
Create a read-only user and password in the wowza web-admin system.
-
Figure out the strange path system that allows me to activate and deactivate the live stream. Here’s what I found:
Start Stream
curl --digest -u "user:password" -X PUT --header 'Accept:application/json; charset=utf-8' --header 'Content-type:application/json; charset=utf-8' "http://192.168.100.88:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/streamfiles/MyLocationName/actions/connect?connectAppName=live&appInstance=_definst_&mediaCasterType=rtp"
End Stream
curl --digest -u "user:password" -X PUT --header 'Accept:application/json; charset=utf-8' --header 'Content-type:application/json; charset=utf-8' "http://192.168.100.88:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/incomingstreams/MyLocationName.stream/actions/disconnectStream"
Running these commands from the whitelisted server command line (linux) seem to now start and stop the stream nicely without deleting the stream file (Did that a few times by accident!).
I do not understand the directory paths in these http URLs and why in one case we just use MyLocationName and the other MyLocationName.stream (I figured that out by trial and error). This seemed way too complex for such a simple concept. Anyway, I hope this saves someone else some time down the road.
NOTE: I’m wondering if there’s a security flaw here since the read-only user is able to do this but maybe I’m wrong…