Adding a stream name group to transcoder`s template using cURL through terminal

Hello!

When I execute in terminal:

curl -X POST --header 'Accept:application/json; charset=utf-8' --header 'Accept:application/json; charset=utf-8' http://wowza-server:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/myapplication/transcoder/templates/mytemplate/streamnamegroups/test01 -d '{
  "name": "test01",
  "serverName": "_defaultServer_",
  "description": "test01",
  "streamName": "test01_all",
  "Members": [
{
      "wowzaVideoOnly": false,
      "wowzaAudioOnly": false,
      "encodeName": "720p",
      "memberName": "720p"
    }
  ]
}'

I receive a error:

{"message":"The server encountered an unexpected condition which prevented it from fulfilling the request","success":false,"wowzaServer":"4.4.1.02","code":"500"}

But If I run the same command from rest-api documentation it succeeded.

Could you help me, please? What’s wrong with my cURL code?

Thank you!

Hi,

It looks like you have two Accept headers in your command. You will need to make sure that you pass a Content-Type header with your REST API POST request, and specify that you are passing a JSON formatted data.

For example, try:

curl -X POST --header 'Accept:application/json; charset=utf-8' --header 'Content-type:application/json; charset=utf-8' http://wowza-server:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/myapplication/transcoder/templates/mytemplate/streamnamegroups/test01 -d '{
  "name": "test01",
  "serverName": "_defaultServer_",
  "description": "test01",
  "streamName": "test01_all",
  "Members": [
{
      "wowzaVideoOnly": false,
      "wowzaAudioOnly": false,
      "encodeName": "720p",
      "memberName": "720p"
    }
  ]
}'

Michelle

Michelle,

Your answer helped. Thank you very much!