Wowza Community

Error while creating application with rest api

I am trying to create a simple application with rest api in python and i am getting error. Please look below my code and error log

PYTHON SCRIPT

import requests
from requests.auth import HTTPDigestAuth

headers = {
‘Content-Type’: ‘application/json; charset=utf-8’,
‘Accept’: ‘application/json; charset=utf-8’
}

data = {
“restURI”: “http://localhost:8087/v2/servers/defaultServer/vhosts/defaultVHost/applications/testlive”,
“name”: “testlive”,
“appType”: “Live”,
“clientStreamReadAccess”: “",
“clientStreamWriteAccess”: "
”,
“description”: “A basic live application”,
“streamConfig”: {
“restURI”: “http://localhost:8087/v2/servers/defaultServer/vhosts/defaultVHost/applications/testlive/streamconfiguration”,
“streamType”: “live”
}
}

url = “http://localhost:8087/v2/servers/defaultServer/vhosts/defaultVHost/applications/testlive”

r = requests.post(url,headers=headers,auth=HTTPDigestAuth(‘username’, ‘password’))

r.json()

RESPONSE:

{‘code’: ‘500’,
‘message’: ‘The server encountered an unexpected condition which prevented it from fulfilling the request’,
‘success’: False,
‘wowzaServer’: ‘4.7.8’}

ERROR LOG:

ERROR server comment 2020-02-03 08:11:45 - - - - - 238714.72 - - - - - - - - class com.wowza.wms.rest.vhosts.applications.ApplicationConfig.post : java.lang.IllegalArgumentException: argument “src” is null|at com.fasterxml.jackson.databind.ObjectReader._assertNotNull(ObjectReader.java:2120)|at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1224)|at org.restlet.ext.jackson.JacksonRepresentation.getObject(JacksonRepresentation.java:309)|at com.wowza.wms.rest.ConfigBase.getObject(ConfigBase.java:2782)|at com.wowza.wms.rest.ConfigBase.post(ConfigBase.java:3575)|

Thanks for sharing the info @developer goplaybook, but Wowza does not officially support a Python wrapped API call so I have no official documentation to share with you.

If you do not get a response from a community member here in the forum, I would suggest checking GitHub where I saw some people posting examples of python wrapped wowza API calls. This is not anything Wowza has built so please know this is all external code.