REST API start up stream example

I did the following request use REST API, but it returns this error: The server encountered an unexpected condition which prevented it from fulfilling the request.

I am quite not so sure what to write in two restURI. Helps please.

{

“restURI”: “http://localhost:8087/v2/servers/defaultServer/vhosts/defaultVHost/startupstreams”,

“serverName”: “”,

“saveFieldList”: [

“”

],

“version”: “”,

“Streams”: [

{

“restURI”: “http://localhost:8087/v2/servers/defaultServer/vhosts/defaultVHost/startupstreams”,

“mediaCasterType”: “rtp”,

“instance”: “”,

“serverName”: “”,

“saveFieldList”: [

“”

],

“version”: “”,

“streamName”: “main2.stream”,

“applicationName”: “544299-1”

}

]

}

It should like this, but it still have the same error.

Request URL: “http://localhost:8087/v2/servers/defaultServer/vhosts/defaultVHost/startupstreams”

And body: {

“restURI”: “http://localhost:8087/v2/servers/defaultServer/vhosts/defaultVHost/startupstreams”,

“version”: “1445839700752”,

“Streams”: [

{

“restURI”: “http://localhost:8087/v2/servers/defaultServer/vhosts/defaultVHost/startupstreams/applications/544299-1/instances/definst/streams/main2.stream”,

“mediaCasterType”: “liverepeater”,

“instance”: “definst”,

“streamName”: “main2.stream”,

“applicationName”: “544299-1”

}

]

}

Hello

You might try the following example:

curl -X POST --header 'Accept:application/json; charset=utf-8' --header 'Content-type:application/json; charset=utf-8' http://[B][wowza-server][/B]:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/startupstreams -d'{
   "appName": "[B][app-name][/B]", 
   "mediaCasterType": "rtp",
   "instance": "_definst_",
   "serverName": "_defaultServer_",
   "streamName": "[B][stream-file-name][/B]",
   "version": "1446125518000"
 }'

This returned successful for me:

{"success":true,"message":"Saved","data":null}

Ensure you replace the following:

[wowza-server] - with your wowza url (ex. localhost)

[app-name] - with your app name (ex. 544299-1)

[stream-file-name] - with your stream file name (ex. main2.stream)

Thanks,

Matt

It’s java.lang.ArrayIndexOutOfBoundsException.

finaly I can add a start up stream one item at a time, it’s enough for me.

but I still wonder I did add array right.

You can try with the following CURL command

LIST Startup Streams

curl -X GET --header 'Accept:application/json; charset=utf-8' --header 'Content-type:application/json; charset=utf-8' http://[B][wowza-server][/B]:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/startupstreams

ADD Startup Stream

curl -X POST --header 'Accept:application/json; charset=utf-8' --header 'Content-type:application/json; charset=utf-8' http://[B][wowza-server][/B]:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/startupstreams -d'{
   "appName": "demo", 
   "mediaCasterType": "rtp",
   "instance": "_definst_",
   "serverName": "_defaultServer_",
   "streamName": "ip.stream"
 } 

MODIFY Startup Stream

curl -X PUT --header 'Accept:application/json; charset=utf-8' --header 'Content-type:application/json; charset=utf-8' http://[B][wowza-server][/B]:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/startupstreams/applications/demo/instances/_definst_/streams/ip.stream -d'{
   "appName": "demo", 
   "mediaCasterType": "rtp",
   "instance": "_definst_",
   "serverName": "_defaultServer_",
   "streamName": "anotherip.stream"
}' 

DELETE Startup Stream

curl -X DELETE --header 'Accept:application/json; charset=utf-8' --header 'Content-type:application/json; charset=utf-8' http://[B][wowza-server][/B]:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/startupstreams/applications/demo/instances/_definst_/streams/ip.stream

These API calls are not documented in the official guide. It’s frustrating to have to find Wowza’s information by luck.