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
(Swift 3,4,5...) Activix CRM Upload a RecordingUpload a recording for an existing communication. For more information, see https://docs.crm.activix.ca/api/resources/communication
func chilkatTest() { // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. let req = CkoHttpRequest()! req.httpVerb = "POST" req.path = "/api/v2/communications/COMMUNICATION_ID/recording" req.contentType = "multipart/form-data" req.addHeader("Accept", value: "application/json") var pathToFileOnDisk: String? = "qa_data/CantinaBand3.wav" var success: Bool = req.addFile(forUpload: "recording", path: pathToFileOnDisk) if success != true { print("\(req.lastErrorText!)") return } let http = CkoHttp()! http.authToken = "ACCESS_TOKEN" var resp: CkoHttpResponse? = http.synchronousRequest("crm.activix.ca", port: 443, ssl: true, req: req) if http.lastMethodSuccess != true { print("\(http.lastErrorText!)") return } print("Response Status Code: \(resp!.statusCode.intValue)") let jsonResponse = CkoJsonObject()! jsonResponse.load(resp!.bodyStr) jsonResponse.emitCompact = false print("\(jsonResponse.emit()!)") if resp!.statusCode.intValue >= 300 { print("Failed.") resp = nil return } resp = nil // Sample output... // { // "message": "Recording uploaded successfully." // } // } |
© 2000-2023 Chilkat Software, Inc. All Rights Reserved.