# cURL request "requires user authentication" - start/stop live streams every M @ 9:50

**URL:** <https://community.wowza.com/t/curl-request-requires-user-authentication-start-stop-live-streams-every-m-9-50/35976>\
**Category:** Wowza Streaming Engine\
**Created:** [June 8, 2016, 9:34am UTC](https://community.wowza.com/t/curl-request-requires-user-authentication-start-stop-live-streams-every-m-9-50/35976 "2016-06-08T09:34:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kenny\_Freundlich](https://avatars.discourse-cdn.com/v4/letter/k/e9a140/32.png) [@Kenny\_Freundlich](https://community.wowza.com/u/Kenny_Freundlich)\
**Post date:** [June 8, 2016, 9:34am UTC](https://community.wowza.com/t/curl-request-requires-user-authentication-start-stop-live-streams-every-m-9-50/35976/1 "2016-06-08T09:34:23Z")

</div>

Hi all. We’re running Wowza Streaming Engine 4.2.0

Our goal is to record the live stream of an AXIS network camera in a Math classroom every Monday in the fall on our Wowza server. From what I’ve read, it looks like the best method is to create a cron job that uses cURL commands to start and stop recordings. (I know only a tiny bit of Linux — just enough to get me in trouble. I’d prefer to do this by [recording live streams with URL queries](https://www.wowza.com/docs/how-to-record-live-streams-httplivestreamrecord%28HTTPLiveStreamRecord%29#livestreamrecordhttpprovider), but I don’t think this can be scheduled. Please correct me if I’m wrong.)

I read the article on [stream recording Query examples](https://www.wowza.com/docs/stream-recording-query-examples).

The webinar on RESTful APIs for Wowza said that 4.2 was required for RESTful APIs, but the web page on stream recording query examples for the REST API says 4.3 is required.

I tried the simplest cURL example (to get the list of all defined stream recordings)

```auto
curl -X GET --header 'Accept:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServ

```

I get an XML error message “The request requires user authentication”

We tried the suggestion from a [thread in July 15](http://community.wowza.com/t/-/45690) that suggested looking at the conf/Server.xml file and setting the /Root/Server/RESTInterface/AuthenticationMethod/ parameter set to “basic”.

We did that, restarted the Wowza service, and then got an Internal Service Error 500. We changed the parameter back to digest, restarted, and all was well.

Do we just need to upgrade to 4.3? Or is there another way to fix the error message on our cURL request?

Thanks so much…k

---

<div class="post-metadata">

**Author:** ![Kenny\_Freundlich](https://avatars.discourse-cdn.com/v4/letter/k/e9a140/32.png) [@Kenny\_Freundlich](https://community.wowza.com/u/Kenny_Freundlich)\
**Post date:** [June 9, 2016, 9:54am UTC](https://community.wowza.com/t/curl-request-requires-user-authentication-start-stop-live-streams-every-m-9-50/35976/2 "2016-06-09T09:54:01Z")

</div>

Doh. Figured out I’d forgotten to add --digest -u “user:pass” to the cURL request. I hadn’t _set_ the authentication method to digest – ‘digest’ must be the default method. Perhaps that could be clarified in future documentation?

One more question:

Which of the parameters for [defining a stream recorder and starting it](https://www.wowza.com/docs/stream-recording-query-examples#createrecord) (see below) are required?

“recorderName”:“myStream”,

“instanceName”:“_definst_”,

“recorderState”:“Waiting for stream”,

“defaultRecorder”:true,

“segmentationType”:“None”,

“outputPath”:"[output-path]",

“baseFile”:“myrecord2.mp4”,

“fileFormat”:“MP4”,

“fileVersionDelegateName”:“com.wowza.wms.livestreamrecord.manager.StreamRecorderFileVersionDelegate”,

“fileTemplate”:"${BaseFileName}_${RecordingStartTime}_${SegmentNumber}",

“segmentDuration”:900000,

“segmentSize”:10485760,

“segmentSchedule”:“0 \* \* \* \* \*”,

“recordData”:true,

“startOnKeyFrame”:true,

“splitOnTcDiscontinuity”:false,

“option”:“Version existing file”,

“moveFirstVideoFrameToZero”:true,

“currentSize”:0,

“currentDuration”:0,

“recordingStartTime”:""

Thanks so much

---

<div class="post-metadata">

**Author:** ![Kenny\_Freundlich](https://avatars.discourse-cdn.com/v4/letter/k/e9a140/32.png) [@Kenny\_Freundlich](https://community.wowza.com/u/Kenny_Freundlich)\
**Post date:** [June 23, 2016, 10:52am UTC](https://community.wowza.com/t/curl-request-requires-user-authentication-start-stop-live-streams-every-m-9-50/35976/3 "2016-06-23T10:52:16Z")

</div>

Thanks so much Paul.

Can you please tell me which of the parameters (recordingStartTime, currentDuration, curentSize, etc.) for defining a stream recorder and starting it are **required**?

---

<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:** [June 23, 2016, 3:44pm UTC](https://community.wowza.com/t/curl-request-requires-user-authentication-start-stop-live-streams-every-m-9-50/35976/4 "2016-06-23T15:44:46Z")

</div>

Hi,

Yes the cURL options of digest are required should you have authentication set for your REST API. You can disable authentication by changing digest to none in install-dir/conf/Server.xml

An example of starting a recording via the REST API is

[PHP]

curl -X POST --digest -u username:password --header ‘Accept:application/json; charset=utf-8’ --header ‘Content-type:application/json; charset=utf-8’ [http://127.0.0.1:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/streamrecorders/myStream](http://127.0.0.1:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/streamrecorders/myStream) -d ’

{

“recorderName”:“myStream”,

“instanceName”:“_definst_”,

“recorderState”:“Waiting for stream”,

“defaultRecorder”:true,

“segmentationType”:“SegmentBySchedule”,

“fileFormat”:“MP4”,

“fileVersionDelegateName”:“com.wowza.wms.livestreamrecord.manager.StreamRecorderFileVersionDelegate”,

“fileTemplate”:"${SourceStreamName}\_${SegmentTime}",

“segmentDuration”:900000,

“segmentSize”:10485760,

“segmentSchedule”:“0 \* \* \* \* \*”,

“recordData”:true,

“startOnKeyFrame”:true,

“splitOnTcDiscontinuity”:false,

“option”:“Version existing file”,

“moveFirstVideoFrameToZero”:true,

“currentSize”:0,

“currentDuration”:0,

“recordingStartTime”:""

}’

[/PHP]

Paul

---

<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, 1:50pm UTC](https://community.wowza.com/t/curl-request-requires-user-authentication-start-stop-live-streams-every-m-9-50/35976/5 "2016-07-27T13:50:59Z")

</div>

Hi,

Really I’d recommend defining all of them. You can experiment with leaving some out and you may still be able to create a recording but you may also find unexpected responses.

Paul
