# stopRecording API not working

**URL:** <https://community.wowza.com/t/stoprecording-api-not-working/47089>\
**Category:** Wowza Developer Dojo\
**Created:** [May 25, 2016, 10:17am UTC](https://community.wowza.com/t/stoprecording-api-not-working/47089 "2016-05-25T10:17:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christopher\_Roed](https://avatars.discourse-cdn.com/v4/letter/c/8baadc/32.png) [@Christopher\_Roed](https://community.wowza.com/u/Christopher_Roed)\
**Post date:** [May 25, 2016, 10:17am UTC](https://community.wowza.com/t/stoprecording-api-not-working/47089/1 "2016-05-25T10:17:05Z")

</div>

Hello,

I’m running wowza streaming engine 4.1.0, and having some trouble with stream recordings. I’m using node.js from an external server to make HTTP requests to my wowza server.

I can successfully start a recording with a digest GET request:

```auto
var qs = QueryString.stringify({
					app :	'live',
					streamname :	stream,
					action :	'startRecording',
				//	segmentDuration	:	30 //time in seconds
				});
				
				console.log("got querystring: " + qs);
				
				var options = {
					host	: "wowza.myserver.com",
					port	:	8086,
					method	:	"GET",
					path	:	"/livestreamrecord?"+qs
				};
				
				Digest.request( options, function ( res){
					console.log("got start record response");
					console.log("headers: ", res.headers);
					console.log("statusCode is: ", res.statusCode);
					console.log("statusMessage is: ", res.statusMessage);
				});

```

I get the output

```auto
got querystring: app=live&streamname=befbf601688edf8a37f14604e93d5cb8&action=startRecording
	CJR making disgest request
	CJR got response headers: { Authorization: 'Digest username=" *****",realm="Wowza Media Systems",nonce="812a5ee5055dc9d72016a86b955474f7",uri="/livestreamrecord?app=live&streamname=befbf601688edf8a37f14604e93d5cb8&action=startRecording",qop="auth",response="951869cc72fb65f974222cf07b8b9f53",opaque="undefined",nc="00000003",cnonce="ee1a576d"' }
	CJR making real request
got start record response
headers: { location: '/livestreamrecord/index.html',
  'content-type': 'text/html',
  connection: 'Keep-Alive',
  server: 'WowzaStreamingEngine/4.1.0',
  'cache-control': 'no-cache',
  'content-length': '0' }
statusCode is: 302
statusMessage is: Found

```

The stop API just replaces startRecording with stopRecording and produces the output

```auto
stopping record stream: befbf601688edf8a37f14604e93d5cb8
got querystring: app=live&streamname=befbf601688edf8a37f14604e93d5cb8&action=stopRecording
	CJR making disgest request
	CJR got response headers: { Authorization: 'Digest username=" *****",realm="Wowza Media Systems",nonce="8c3bd2cb3fe52b1f14657a602d1fa5b9",uri="/livestreamrecord?app=live&streamname=befbf601688edf8a37f14604e93d5cb8&action=stopRecording",qop="auth",response="c9fb7d01a147052d365f69dfcfc08d08",opaque="undefined",nc="00000004",cnonce="353c2797"' }
	CJR making real request
got stop record response
headers: { 'www-authenticate': 'Digest realm="Wowza Media Systems", nonce="ce8251f556a4859b0226363d1de5e34c", algorithm=MD5, qop="auth"',
  'content-type': 'text/html',
  connection: 'Keep-Alive',
  server: 'WowzaStreamingEngine/4.1.0',
  'cache-control': 'no-cache',
  'content-length': '0' }
statusCode is: 401
statusMessage is: Unauthorized

```

As such, the file isn’t saved until the live stream is shut down, and I’m left with orphaned recording sessions that are waiting for streams on the livestreamrecord/index.html page.

UPDATE: I was able to succesfully start and stop a recording session using my brower with the following API, so I know that my server configured correctly

```auto
http://[username]:[password]@[wowza-ip-address]:8086/livestreamrecord?app=live&streamname=myStream&action=startRecording OR action=stopRecording

```

Based on this behavior, I would expect the api to return a 302 redirect upon a successful call, but I’m still seeing a 401 unauthorized from my node.js server.

UPDATE2: I must have been formulating my “stop” function incorrectly. I did a copy/paste of the start recording function and replaced start with stop and not everything is working, however it’s extremely slow. It takes about 8 seconds to get a response from my wowza server, instead of ~150mS when I make the request from a browser.

---

<div class="post-metadata">

**Author:** ![Christopher\_Roed](https://avatars.discourse-cdn.com/v4/letter/c/8baadc/32.png) [@Christopher\_Roed](https://community.wowza.com/u/Christopher_Roed)\
**Post date:** [May 27, 2016, 12:43pm UTC](https://community.wowza.com/t/stoprecording-api-not-working/47089/2 "2016-05-27T12:43:00Z")

</div>

If you’re just looking for start and stop recording, the wowza-control module for node.js works quite well, and is set up by default to make digest requests.

Also, this page was very helpfull–\> [https://www.wowza.com/docs/how-to-record-live-streams-httplivestreamrecord](https://www.wowza.com/docs/how-to-record-live-streams-httplivestreamrecord)
