Chilkat • HOME • Android™ • AutoIt • C • C# • C++ • Chilkat2-Python • CkPython • Classic ASP • DataFlex • Delphi DLL • Go • Java • Node.js • Objective-C • PHP Extension • Perl • PowerBuilder • PowerShell • PureBasic • Ruby • SQL Server • Swift • Tcl • Unicode C • Unicode C++ • VB.NET • VBScript • Visual Basic 6.0 • Visual FoxPro • Xojo Plugin
(Delphi ActiveX) Activix CRM Upload a RecordingUpload a recording for an existing communication. For more information, see https://docs.crm.activix.ca/api/resources/communication
uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Chilkat_TLB; ... procedure TForm1.Button1Click(Sender: TObject); var req: TChilkatHttpRequest; pathToFileOnDisk: WideString; success: Integer; http: TChilkatHttp; resp: IChilkatHttpResponse; jsonResponse: TChilkatJsonObject; begin // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. req := TChilkatHttpRequest.Create(Self); 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 <> 1) then begin Memo1.Lines.Add(req.LastErrorText); Exit; end; http := TChilkatHttp.Create(Self); http.AuthToken := 'ACCESS_TOKEN'; resp := http.SynchronousRequest('crm.activix.ca',443,1,req.ControlInterface); if (http.LastMethodSuccess <> 1) then begin Memo1.Lines.Add(http.LastErrorText); Exit; end; Memo1.Lines.Add('Response Status Code: ' + IntToStr(resp.StatusCode)); jsonResponse := TChilkatJsonObject.Create(Self); jsonResponse.Load(resp.BodyStr); jsonResponse.EmitCompact := 0; Memo1.Lines.Add(jsonResponse.Emit()); if (resp.StatusCode >= 300) then begin Memo1.Lines.Add('Failed.'); Exit; end; // Sample output... // { // "message": "Recording uploaded successfully." // } // end; |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.