Wowza Community

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

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, 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.

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)

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 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

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 (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

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?

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 -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

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