(AutoIt) Activix CRM Upload a Recording
Upload a recording for an existing communication. For more information, see https://docs.crm.activix.ca/api/resources/communication
; This example requires the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oReq = ObjCreate("Chilkat.HttpRequest")
$oReq.HttpVerb = "POST"
$oReq.Path = "/api/v2/communications/COMMUNICATION_ID/recording"
$oReq.ContentType = "multipart/form-data"
$oReq.AddHeader "Accept","application/json"
Local $sPathToFileOnDisk = "qa_data/CantinaBand3.wav"
Local $bSuccess = $oReq.AddFileForUpload("recording",$sPathToFileOnDisk)
If ($bSuccess <> True) Then
ConsoleWrite($oReq.LastErrorText & @CRLF)
Exit
EndIf
$oHttp = ObjCreate("Chilkat.Http")
$oHttp.AuthToken = "ACCESS_TOKEN"
Local $oResp = $oHttp.SynchronousRequest("crm.activix.ca",443,True,$oReq)
If ($oHttp.LastMethodSuccess <> True) Then
ConsoleWrite($oHttp.LastErrorText & @CRLF)
Exit
EndIf
ConsoleWrite("Response Status Code: " & $oResp.StatusCode & @CRLF)
$oJsonResponse = ObjCreate("Chilkat.JsonObject")
$oJsonResponse.Load($oResp.BodyStr)
$oJsonResponse.EmitCompact = False
ConsoleWrite($oJsonResponse.Emit() & @CRLF)
If ($oResp.StatusCode >= 300) Then
ConsoleWrite("Failed." & @CRLF)
Exit
EndIf
; Sample output...
; {
; "message": "Recording uploaded successfully."
; }
;
|