# Connecting and disconnecting to a stream (REST API)

**URL:** <https://community.wowza.com/t/connecting-and-disconnecting-to-a-stream-rest-api/46322>\
**Category:** Wowza Developer Dojo\
**Created:** [June 30, 2016, 9:22am UTC](https://community.wowza.com/t/connecting-and-disconnecting-to-a-stream-rest-api/46322 "2016-06-30T09:22:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nelson\_Ochoa](https://avatars.discourse-cdn.com/v4/letter/n/2acd7d/32.png) [@Nelson\_Ochoa](https://community.wowza.com/u/Nelson_Ochoa)\
**Post date:** [June 30, 2016, 9:22am UTC](https://community.wowza.com/t/connecting-and-disconnecting-to-a-stream-rest-api/46322/1 "2016-06-30T09:22:46Z")

</div>

Hi,

I am currently using wowza version 4.4.1 I am trying to figure out how can I start and stop a stream using the REST API. I know how to do it from the admin panel by going to my app and selecting a stream an selecting connect or going to the streammanager and starting it. I could not find out how to do it on the REST API documentation. I have read in other posts that it is possible to do it by posting to the /streammanager/streamAction endpoint but when doing that I get a 401 for some reason any ideas how could I achieve this using the REST API or another wowza endpoint?

Here is the curl command:

curl -XPOST -digest -u user:password --data “action=startStream&vhostName=_defaultVHost_&appName=nvcEncoder\_transcode/_definst_&streamName=160607-ch-f99d.stream&mediaCasterType=rtp” [http://localhost:8086/streammanager/streamAction](http://localhost:8086/streammanager/streamAction)

But it is not doing anything ☹

Any thoughts?

---

<div class="post-metadata">

**Author:** ![Paul\_Shields](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/paul_shields/32/390_2.png) [@Paul\_Shields](https://community.wowza.com/u/Paul_Shields)\
**Post date:** [July 27, 2016, 2:33pm UTC](https://community.wowza.com/t/connecting-and-disconnecting-to-a-stream-rest-api/46322/2 "2016-07-27T14:33:53Z")

</div>

Hi,

401 suggests unauthorised access so make sure your credentials are correct and you’ve whitelisted your address. Your example seems to be using the HTTP Provider (port 8086) rather than the REST API (port 8087).

You should be able to set a stream file to active with something like

```auto
curl -X PUT --header 'Accept:application/json; charset=utf-8' --header 'Content-type:application/json; charset=utf-8' "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/streamfiles/axiscam/actions/connect?connectAppName=live&appInstance=_definst_&mediaCasterType=rtp"

```

That would make the stream file axiscam.stream active in the “live” application.

Regards,

Paul
