Objective-C / Plivo REST API / Stop currently active recording
Back to Collection Items
#import <CkoHttp.h>
#import <CkoJsonObject.h>
#import <CkoStringBuilder.h>
#import <CkoHttpResponse.h>
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkoHttp *http = [[CkoHttp alloc] init];
BOOL success;
http.BasicAuth = YES;
http.Login = @"{{auth_id}}";
http.Password = @"password";
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "URL": "http://s3.amazonaws.com/recordings_2013/48dfaf60-3b2a-11e3.mp3"
// }
CkoJsonObject *json = [[CkoJsonObject alloc] init];
[json UpdateString: @"URL" value: @"http://s3.amazonaws.com/recordings_2013/48dfaf60-3b2a-11e3.mp3"];
CkoStringBuilder *sbRequestBody = [[CkoStringBuilder alloc] init];
[json EmitSb: sbRequestBody];
CkoHttpResponse *resp = [http PTextSb: @"DELETE" url: @"https://api.plivo.com/v1/Account/<auth_id>/Call/{call_uuid}/Record/" textData: sbRequestBody charset: @"utf-8" contentType: @"application/json" md5: NO gzip: NO];
if (http.LastMethodSuccess == NO) {
NSLog(@"%@",http.LastErrorText);
return;
}
int respStatusCode = [resp.StatusCode intValue];
NSLog(@"%@%d",@"Response Status Code = ",respStatusCode);
if (respStatusCode != 204) {
NSLog(@"%@",@"Response Header:");
NSLog(@"%@",resp.Header);
NSLog(@"%@",@"Response Body:");
NSLog(@"%@",resp.BodyStr);
NSLog(@"%@",@"Failed.");
return;
}
NSLog(@"%@",@"Success.");
Curl Command
curl -X DELETE
-u '{{auth_id}}:password'
-d '{
"URL":"http://s3.amazonaws.com/recordings_2013/48dfaf60-3b2a-11e3.mp3"
}'
https://api.plivo.com/v1/Account/<auth_id>/Call/{call_uuid}/Record/
Postman Collection Item JSON
{
"name": "Stop currently active recording",
"request": {
"method": "DELETE",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"URL\":\"http://s3.amazonaws.com/recordings_2013/48dfaf60-3b2a-11e3.mp3\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://api.plivo.com/v1/Account/{{auth_id}}/Call/{call_uuid}/Record/",
"protocol": "https",
"host": [
"api",
"plivo",
"com"
],
"path": [
"v1",
"Account",
"{{auth_id}}",
"Call",
"{call_uuid}",
"Record",
""
]
}
},
"response": [
{
"name": "Stop currently active recording",
"originalRequest": {
"method": "DELETE",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"URL\":\"http://s3.amazonaws.com/recordings_2013/48dfaf60-3b2a-11e3.mp3\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://api.plivo.com/v1/Account/{{auth_id}}/Call/{call_uuid}/Record/",
"protocol": "https",
"host": [
"api",
"plivo",
"com"
],
"path": [
"v1",
"Account",
"{{auth_id}}",
"Call",
"{call_uuid}",
"Record",
""
]
}
},
"code": 204,
"_postman_previewlanguage": "Text",
"header": [
],
"cookie": [
],
"body": ""
}
]
}