![]() |
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
(Swift) Activix CRM Upload a RecordingUpload a recording for an existing communication. Note: This example requires Chilkat v11.0.0 or greater. For more information, see https://docs.crm.activix.ca/api/resources/communication
func chilkatTest() { var success: Bool = false // 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" success = req.addFile(forUpload: "recording", path: pathToFileOnDisk) if success == false { print("\(req.lastErrorText!)") return } let http = CkoHttp()! http.authToken = "ACCESS_TOKEN" let resp = CkoHttpResponse()! success = http.httpSReq("crm.activix.ca", port: 443, ssl: true, request: req, response: resp) if success == false { 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.") return } // Sample output... // { // "message": "Recording uploaded successfully." // } // } |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.