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
(Objective-C) Activix CRM Upload a RecordingUpload a recording for an existing communication. For more information, see https://docs.crm.activix.ca/api/resources/communication
#import <CkoHttpRequest.h> #import <NSString.h> #import <CkoHttp.h> #import <CkoHttpResponse.h> #import <CkoJsonObject.h> // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. CkoHttpRequest *req = [[CkoHttpRequest alloc] init]; req.HttpVerb = @"POST"; req.Path = @"/api/v2/communications/COMMUNICATION_ID/recording"; req.ContentType = @"multipart/form-data"; [req AddHeader: @"Accept" value: @"application/json"]; NSString *pathToFileOnDisk = @"qa_data/CantinaBand3.wav"; BOOL success = [req AddFileForUpload: @"recording" path: pathToFileOnDisk]; if (success != YES) { NSLog(@"%@",req.LastErrorText); return; } CkoHttp *http = [[CkoHttp alloc] init]; http.AuthToken = @"ACCESS_TOKEN"; CkoHttpResponse *resp = [http SynchronousRequest: @"crm.activix.ca" port: [NSNumber numberWithInt: 443] ssl: YES req: req]; if (http.LastMethodSuccess != YES) { NSLog(@"%@",http.LastErrorText); return; } NSLog(@"%@%d",@"Response Status Code: ",[resp.StatusCode intValue]); CkoJsonObject *jsonResponse = [[CkoJsonObject alloc] init]; [jsonResponse Load: resp.BodyStr]; jsonResponse.EmitCompact = NO; NSLog(@"%@",[jsonResponse Emit]); if ([resp.StatusCode intValue] >= 300) { NSLog(@"%@",@"Failed."); return; } // Sample output... // { // "message": "Recording uploaded successfully." // } // |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.