REST API or Java call to Disable/Enable Stream Targets

EngineManager has a handy button that disables all stream targets for an application, but I can’t find a call to do that in either the REST API documentation nor the cURL usage page.

In my environments I have two servers set up behind a round-robin configured such that if either server goes down the entire network load is transferred entirely to whatever server is still up. These two servers each have ShoutCast streams and scheduled content streams running as inputs and they’re capable of re-streaming them to the network via multicast. Obviously, I can’t have both of them multicasting at the same time but one has to always be multicasting. Currently (Wowza 3) I have a customized version of ModuleMulticastPublish with which I’m able to enable/disable all multicast if/when the server that’s currently doing the multicasting goes down within about half a second. I’d like to get away from that a bit and use the built-in features of Wowza 4, but I can’t see how StreamManager is doing it.

What I need is a REST API or programmatic way to enable/disable all stream targets in an application in the same way hitting the Enable/Disable Stream Targets buttons work through EngineManager. I can’t figure out what command is being issued by EngineManager to Wowza (nor why it isn’t documented).

Hello

We do provide an endpoint to disable a stream target. You can see this on our documentation server described as a put request as follows:

PUT /v2/servers/{serverName}/vhosts/{vhostName}/applications/{appName}/pushpublish/mapentries/{entryName}/actions/{action}

A cURL example might look like:

curl --digest -u "user:pass" -X PUT --header 'Accept:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/pushpublish/mapentries/test/actions/disable

You have to do this on a per entry basis. You can obtain a list of all entries and iterate through them as required and disable the given target.

GET /v2/servers/{serverName}/vhosts/{vhostName}/applications/{appName}/pushpublish/mapentries

Thanks,

Matt

Thank you! I was looking for something with target in the name and those didn’t mentally register as possibilities.

I am trying this call with a a mapentry named “test” just like above but keep receiving the answer below, “Unknown action”. I’ve tried other actions as well. Any ideas?

http://wowza-server:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/pushpublish/mapentries/test/actions/enable

{
    "data": null,
    "message": "Unknown action: enable",
    "success": false
}

@Brian Slezak: I think you have replace ‘test’ by an existing apllication name.

Nevertheless … I have the same problem even with an existing application name. Gives me a 404 error:

Request URL

http://192.168.2.5:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/Leeuwarden/pushpublish/mapentries/enabled

Response Body

<code>{
  "message": "The server has not found anything matching the request URI",
  "code": "404",
  "wowzaServer": "4.7.3.01",
  "success": false
}

Hopefully someone from Wowza can help?

Got it working.
http://192.168.2.5:8087/v2/servers/defaultServer/vhosts/defaultVHost/applications/Leeuwarden/pushpublish/mapentries/enabled

should be

http://192.168.2.5:8087/v2/servers/defaultServer/vhosts/defaultVHost/applications/Leeuwarden/pushpublish/mapentries/Leeuwarden/actions/{copy, enable, disable or restart}

What the restart action is supposed to do? In my application, it does nothing apparently.