Sample code for 30+ languages & platforms
CkPython

Activix CRM Upload a Recording

See more Activix CRM Examples

Upload a recording for an existing communication.

Chilkat CkPython Downloads

CkPython
import sys
import chilkat

success = False

# 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 == False):
    print(req.lastErrorText())
    sys.exit()

http = chilkat.CkHttp()
http.put_AuthToken("ACCESS_TOKEN")

resp = chilkat.CkHttpResponse()
success = http.HttpSReq("crm.activix.ca",443,True,req,resp)
if (success == False):
    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."
# }
#