# 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:** 3
**Page:** 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

---

<div class="post-metadata">

### Author: ![Amara\_Graham](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/amara_graham/32/381_2.png) [@Amara\_Graham](https://community.wowza.com/u/Amara_Graham)
#### Post date: [August 25, 2020, 10:09pm UTC](https://community.wowza.com/t/how-to-stop-streaming-using-wowza-restapis/55751/2 "2020-08-25T22:09:07Z")

</div>

Try running your query on port 8087 instead of 8086. I get the same behavior on 8086, 200 with my Engine build configuration, which appears to be expected behavior (1935 does the same thing).

I would also recommend using curl or Postman to test your queries to make sure your Python code is behaving as you expect it.

---

<div class="post-metadata">

### Author: ![Rose\_Power-Wowza\_Com](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/rose_power-wowza_com/32/431_2.png) [@Rose\_Power-Wowza\_Com](https://community.wowza.com/u/Rose_Power-Wowza_Com)
#### Post date: [August 31, 2020, 5:03pm UTC](https://community.wowza.com/t/how-to-stop-streaming-using-wowza-restapis/55751/3 "2020-08-31T17:03:41Z")

</div>

Please see this post for additional information.

[http://community.wowza.com/community/questions/49449/is-there-any-way-to-stop-stream-using-wowza-engine.html](http://community.wowza.com/community/questions/49449/is-there-any-way-to-stop-stream-using-wowza-engine.html)

You can submit a [support ticket](http://community.wowza.com/community/questions/49449/is-there-any-way-to-stop-stream-using-wowza-engine.html) if you still need help with stopping the stream when the viewer clicks ‘Finish’.
