Sample code for 30+ languages & platforms
Chilkat2-Python

Activix CRM Upload a Recording

See more Activix CRM Examples

Upload a recording for an existing communication.

Chilkat Chilkat2-Python Downloads

Chilkat2-Python
import sys
import chilkat2

success = False

# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

req = chilkat2.HttpRequest()

req.HttpVerb = "POST"
req.Path = "/api/v2/communications/COMMUNICATION_ID/recording"
req.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 = chilkat2.Http()
http.AuthToken = "ACCESS_TOKEN"

resp = chilkat2.HttpResponse()
success = http.HttpSReq("crm.activix.ca",443,True,req,resp)
if (success == False):
    print(http.LastErrorText)
    sys.exit()

print("Response Status Code: " + str(resp.StatusCode))

jsonResponse = chilkat2.JsonObject()
jsonResponse.Load(resp.BodyStr)
jsonResponse.EmitCompact = False
print(jsonResponse.Emit())

if (resp.StatusCode >= 300):
    print("Failed.")
    sys.exit()

# Sample output...

# {
#   "message": "Recording uploaded successfully."
# }
#