(Ruby) Activix CRM Upload a Recording
Upload a recording for an existing communication. For more information, see https://docs.crm.activix.ca/api/resources/communication
require 'chilkat'
# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
req = Chilkat::CkHttpRequest.new()
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() + "\n";
exit
end
http = Chilkat::CkHttp.new()
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() + "\n";
exit
end
print "Response Status Code: " + resp.get_StatusCode().to_s() + "\n";
jsonResponse = Chilkat::CkJsonObject.new()
jsonResponse.Load(resp.bodyStr())
jsonResponse.put_EmitCompact(false)
print jsonResponse.emit() + "\n";
if (resp.get_StatusCode() >= 300)
print "Failed." + "\n";
exit
end
# Sample output...
# {
# "message": "Recording uploaded successfully."
# }
#
|