(CkPython) Activix CRM Upload a Recording
Upload a recording for an existing communication. For more information, see https://docs.crm.activix.ca/api/resources/communication
import sys
import chilkat
# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
req = chilkat.CkHttpRequest()
req.put_HttpVerb("POST")
req.put_Path("/api/v2/communications/COMMUNICATION_ID/recording")
req.put_ContentType("multipart/form-data")
req.AddHeader("Accept","application/json")
pathToFileOnDisk = "qa_data/CantinaBand3.wav"
success = req.AddFileForUpload("recording",pathToFileOnDisk)
if (success != True):
print(req.lastErrorText())
sys.exit()
http = chilkat.CkHttp()
http.put_AuthToken("ACCESS_TOKEN")
# resp is a CkHttpResponse
resp = http.SynchronousRequest("crm.activix.ca",443,True,req)
if (http.get_LastMethodSuccess() != True):
print(http.lastErrorText())
sys.exit()
print("Response Status Code: " + str(resp.get_StatusCode()))
jsonResponse = chilkat.CkJsonObject()
jsonResponse.Load(resp.bodyStr())
jsonResponse.put_EmitCompact(False)
print(jsonResponse.emit())
if (resp.get_StatusCode() >= 300):
print("Failed.")
sys.exit()
# Sample output...
# {
# "message": "Recording uploaded successfully."
# }
#
|