Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PureBasic) Activix CRM Upload a RecordingUpload a recording for an existing communication. For more information, see https://docs.crm.activix.ca/api/resources/communication
IncludeFile "CkHttpResponse.pb" IncludeFile "CkHttp.pb" IncludeFile "CkJsonObject.pb" IncludeFile "CkHttpRequest.pb" Procedure ChilkatExample() ; This example requires the Chilkat API to have been previously unlocked. ; See Global Unlock Sample for sample code. req.i = CkHttpRequest::ckCreate() If req.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkHttpRequest::setCkHttpVerb(req, "POST") CkHttpRequest::setCkPath(req, "/api/v2/communications/COMMUNICATION_ID/recording") CkHttpRequest::setCkContentType(req, "multipart/form-data") CkHttpRequest::ckAddHeader(req,"Accept","application/json") pathToFileOnDisk.s = "qa_data/CantinaBand3.wav" success.i = CkHttpRequest::ckAddFileForUpload(req,"recording",pathToFileOnDisk) If success <> 1 Debug CkHttpRequest::ckLastErrorText(req) CkHttpRequest::ckDispose(req) ProcedureReturn EndIf http.i = CkHttp::ckCreate() If http.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkHttp::setCkAuthToken(http, "ACCESS_TOKEN") resp.i = CkHttp::ckSynchronousRequest(http,"crm.activix.ca",443,1,req) If CkHttp::ckLastMethodSuccess(http) <> 1 Debug CkHttp::ckLastErrorText(http) CkHttpRequest::ckDispose(req) CkHttp::ckDispose(http) ProcedureReturn EndIf Debug "Response Status Code: " + Str(CkHttpResponse::ckStatusCode(resp)) jsonResponse.i = CkJsonObject::ckCreate() If jsonResponse.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkJsonObject::ckLoad(jsonResponse,CkHttpResponse::ckBodyStr(resp)) CkJsonObject::setCkEmitCompact(jsonResponse, 0) Debug CkJsonObject::ckEmit(jsonResponse) If CkHttpResponse::ckStatusCode(resp) >= 300 Debug "Failed." CkHttpResponse::ckDispose(resp) CkHttpRequest::ckDispose(req) CkHttp::ckDispose(http) CkJsonObject::ckDispose(jsonResponse) ProcedureReturn EndIf CkHttpResponse::ckDispose(resp) ; Sample output... ; { ; "message": "Recording uploaded successfully." ; } ; CkHttpRequest::ckDispose(req) CkHttp::ckDispose(http) CkJsonObject::ckDispose(jsonResponse) ProcedureReturn EndProcedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.