(JavaScript) Activix CRM Upload a Recording
Upload a recording for an existing communication. For more information, see https://docs.crm.activix.ca/api/resources/communication
var success = false;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
var req = new CkHttpRequest();
req.HttpVerb = "POST";
req.Path = "/api/v2/communications/COMMUNICATION_ID/recording";
req.ContentType = "multipart/form-data";
req.AddHeader("Accept","application/json");
var pathToFileOnDisk = "qa_data/CantinaBand3.wav";
success = req.AddFileForUpload("recording",pathToFileOnDisk);
if (success == false) {
console.log(req.LastErrorText);
return;
}
var http = new CkHttp();
http.AuthToken = "ACCESS_TOKEN";
var resp = new CkHttpResponse();
success = http.HttpSReq("crm.activix.ca",443,true,req,resp);
if (success == false) {
console.log(http.LastErrorText);
return;
}
console.log("Response Status Code: " + resp.StatusCode);
var jsonResponse = new CkJsonObject();
jsonResponse.Load(resp.BodyStr);
jsonResponse.EmitCompact = false;
console.log(jsonResponse.Emit());
if (resp.StatusCode >= 300) {
console.log("Failed.");
return;
}
// Sample output...
// {
// "message": "Recording uploaded successfully."
// }
//
|