![]() |
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
(Objective-C) 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
#import <CkoHttpRequest.h> #import <NSString.h> #import <CkoHttp.h> #import <CkoHttpResponse.h> #import <CkoJsonObject.h> BOOL success = NO; // 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"; success = [req AddFileForUpload: @"recording" path: pathToFileOnDisk]; if (success == NO) { NSLog(@"%@",req.LastErrorText); return; } CkoHttp *http = [[CkoHttp alloc] init]; http.AuthToken = @"ACCESS_TOKEN"; CkoHttpResponse *resp = [[CkoHttpResponse alloc] init]; success = [http HttpSReq: @"crm.activix.ca" port: [NSNumber numberWithInt: 443] ssl: YES request: req response: resp]; if (success == NO) { 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-2025 Chilkat Software, Inc. All Rights Reserved.