# how to stop streaming using Wowza RestAPIs?

**URL:** <https://community.wowza.com/t/how-to-stop-streaming-using-wowza-restapis/55751>\
**Category:** Wowza Streaming Engine\
**Created:** [August 24, 2020, 2:06pm UTC](https://community.wowza.com/t/how-to-stop-streaming-using-wowza-restapis/55751 "2020-08-24T14:06:02Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![othman\_EL-Kurdi](https://avatars.discourse-cdn.com/v4/letter/o/aca169/32.png) [@othman\_EL-Kurdi](https://community.wowza.com/u/othman_EL-Kurdi)\
**Post date:** [August 24, 2020, 2:06pm UTC](https://community.wowza.com/t/how-to-stop-streaming-using-wowza-restapis/55751/1 "2020-08-24T14:06:02Z")

</div>

Hello there,

I am trying to build a live stream application using WOWZA, but I am facing a problem in finishing/ending/stopping/ deleting the stream.

using the RestAPI’s described in the REST API Documentation I am able for example to retrieve publishers list using the following API:

**Note: following APIs written in python-flask application.**

```auto
URL_RETRIEVE_PUBLISHERS_LIST = "http://{}:{}/v2/servers/{}/vhosts/{}/applications/{}/publishers".format(settings.WSE_IP, settings.WSE_SERVER_PORT, settings.WSE_SERVER_NAME, settings.WSE_VHOST_NAME, settings.WSE_LIVE_APP_NAME)
response = requests.get(URL_RETRIEVE_PUBLISHERS_LIST,auth=(settings.WOWZA_USERNAME, settings.WOWZA_PASSWORD))

```

I used disconnect stream API to disconnect the stream, as follows:

```auto
URL_DISCONNECT_STREAM_WITH_STREAM_KEY = "http://{}:{}/v2/servers/{}/vhosts/{}/applications/{}/instances/{}/incomingstreams/{}/actions/0".format(
    settings.WSE_IP, settings.WSE_SERVER_PORT, settings.WSE_SERVER_NAME, settings.WSE_VHOST_NAME,
    settings.WSE_LIVE_APP_NAME, instanceName, stream_key)

```

and got the following response:

```auto
<response[200]>: content: b'<?xml version="1.0" encoding="UTF-8" ?>\n<wmsResponse>\n <success>false</success>\n <message>Unknown action: 0</message>\n</wmsResponse>'

```

when I change the action in the API to disconnectStream except of “0”: I get \<response[404]\>

I’ve used as well the http stream control plugin, following is it’s link: [how-to-control-stream-class-streams-dynamically-httpstreamcontrol](https://www.wowza.com/docs/how-to-control-stream-class-streams-dynamically-httpstreamcontrol)

following is the API used to call the stop\_stream action:

```auto
URL_DISCONNECT_STREAM_WITH_STREAM_KEY = "http://{}:8086/streamcontrol?appName={}&action=stopStream&streamName={}".format(settings.WSE_IP, settings.WSE_LIVE_APP_NAME, stream_key)
response = requests.get(URL_DISCONNECT_STREAM_WITH_STREAM_KEY, auth=(settings.WOWZA_USERNAME,settings.WOWZA_PASSWORD))

```

it returns

```auto
<response[200]>: content: b'<html><head><title>Wowza Streaming Engine 4 Developer Edition (Expires: Dec 17, 2020) 4.8.5 build20200616153358</title></head><body>Wowza Streaming Engine 4 Developer Edition (Expires: Dec 17, 2020) 4.8.5 build20200616153358</body></html>'

```

but without ending the specified stream.

my question is : how can I end/finish/stop the stream using an API, so that I can activate the onStreamDestroy/onDisconnect event in my WowzaJavaModule?

All what I need to do is to end the stream so that the events in my WowzaJavaModule start!

any suggestion would be highly appriciated.

thanks in advanced

othman

---

_[View the full topic](https://community.wowza.com/t/how-to-stop-streaming-using-wowza-restapis/55751)._
