delphiDll / Plivo REST API / Stop currently active recording
Back to Collection Items
var
http: HCkHttp;
success: Boolean;
json: HCkJsonObject;
sbRequestBody: HCkStringBuilder;
resp: HCkHttpResponse;
respStatusCode: Integer;
begin
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http := CkHttp_Create();
CkHttp_putBasicAuth(http,True);
CkHttp_putLogin(http,'{{auth_id}}');
CkHttp_putPassword(http,'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"
// }
json := CkJsonObject_Create();
CkJsonObject_UpdateString(json,'URL','http://s3.amazonaws.com/recordings_2013/48dfaf60-3b2a-11e3.mp3');
sbRequestBody := CkStringBuilder_Create();
CkJsonObject_EmitSb(json,sbRequestBody);
resp := CkHttp_PTextSb(http,'DELETE','https://api.plivo.com/v1/Account/<auth_id>/Call/{call_uuid}/Record/',sbRequestBody,'utf-8','application/json',False,False);
if (CkHttp_getLastMethodSuccess(http) = False) then
begin
Memo1.Lines.Add(CkHttp__lastErrorText(http));
Exit;
end;
respStatusCode := CkHttpResponse_getStatusCode(resp);
Memo1.Lines.Add('Response Status Code = ' + IntToStr(respStatusCode));
if (respStatusCode <> 204) then
begin
Memo1.Lines.Add('Response Header:');
Memo1.Lines.Add(CkHttpResponse__header(resp));
Memo1.Lines.Add('Response Body:');
Memo1.Lines.Add(CkHttpResponse__bodyStr(resp));
Memo1.Lines.Add('Failed.');
CkHttpResponse_Dispose(resp);
Exit;
end;
CkHttpResponse_Dispose(resp);
Memo1.Lines.Add('Success.');
CkHttp_Dispose(http);
CkJsonObject_Dispose(json);
CkStringBuilder_Dispose(sbRequestBody);
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": ""
}
]
}