Delete a Recording
You're ready for this how-to guide if you've got the following:
A FreeClimb account
A registered application
A configured FreeClimb Number
Your tools and language installed
Node.js
To initiate any interaction, one must use the FreeClimb API. Using the FreeClimb SDK, an asynchronous request to delete a given recording can be initiated. For this FreeClimb interaction only negative results in the form of an exception are returned. Note, you'll need to use your own specific recordingId
.
Create your package.json file and save in the root directory of your project:
{
"name": "node-delete-recording-how-to-guide",
"version": "1.0.0",
"license": "MIT",
"dependencies": {
"@freeclimb/sdk": "^3.8.0",
"dotenv": "^8.1.0"
}
}
Install the package by running the following in the command line/terminal:
yarn install
Example code:
require('dotenv').config()
const freeclimbSDK = require('@freeclimb/sdk')
const accountId = process.env.ACCOUNT_ID
const apiKey = process.env.API_KEY
const configuration = freeclimbSDK.createConfiguration({ accountId, apiKey })
const freeclimb = new freeclimbSDK.DefaultApi(configuration)
const recordingId = 'YOUR_RECORDING_ID'
freeclimb.deleteARecording(recordingId).catch(err => { console.log(err) })
Java
To initiate any interaction with FreeClimb a FreeClimbClient
object must be created. Using the RecordingsRequester
created upon successful creation of the FreeClimbClient
a synchronous request to delete a given recording can be initiated. For this FreeClimb interaction only negative results in the form of an exception are returned. Note, you'll need to use your own specific recordingId
.
Create your build.gradle file and save it to the root directory in your project:
/*
* This file was generated by the Gradle 'init' task.
*
* This is a general purpose Gradle build.
* Learn how to create Gradle builds at https://guides.gradle.org/creating-new-gradle-builds
*/
buildscript {
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
//Add the dependency
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:2.1.6.RELEASE"
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
bootJar {
baseName = 'gs-spring-boot'
version = '0.1.0'
}
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile "org.springframework.boot:spring-boot-starter-web"
testCompile "junit:junit"
compile 'com.github.FreeClimbAPI:FreeClimb-Java-SDK:3.0.0'
}
sourceSets {
main {
java {
srcDirs = ['src'] // changed line
}
}
}
Build the file by running the following in your terminal/command line:
gradle build
Example code:
/*
* AFTER RUNNING PROJECT WITH COMMAND:
* `gradle build && java -Dserver.port=0080 -jar build/libs/gs-spring-boot-0.1.0.jar`
* RUN CURL COMMAND:
* `curl {HOST}/deleteRecording`
* EXPECT NOTHING TO BE RETURNED & THE OLD RECORDING SHOULD BE DELETED UNDER YOUR FREECLIMB ACCOUNT, WHICH CAN BE FOUND VISUALLY IN FREECLIMB DASHBOARD
*/
package main.java.delete_recording;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import com.vailsys.freeclimb.api.FreeClimbClient;
import com.vailsys.freeclimb.api.FreeClimbException;
@RestController
public class DeleteRecordingController {
@RequestMapping("/deleteRecording")
public void deleteRecording() {
FreeClimbClient client;
try {
// Create FreeClimbClient object
String accountId = System.getenv("ACCOUNT_ID");
String apiKey = System.getenv("API_KEY");
client = new FreeClimbClient(accountId, apiKey);
String recordingId = "RErecordingId"; // desired recordingId to be deleted
client.recordings.delete(recordingId);
} catch (FreeClimbException pe) {
System.out.println(pe.getMessage());
}
}
}
C#
To initiate any interaction with FreeClimb a FreeClimbClient
object must be created. Using the RecordingsRequester
created upon successful creation of the FreeClimbClient
a synchronous request to delete a given recording can be initiated. For this FreeClimb interaction only negative results in the form of an exception are returned.
Example code:
try {
string freeClimbAccountId = System.Environment.GetEnvironmentVariable("ACCOUNT_ID");
string freeClimbApiKey = System.Environment.GetEnvironmentVariable("API_KEY");
string recordingId = "";
// Create FreeClimbClient object
FreeClimbClient client = new FreeClimbClient (freeClimbAccountId, freeClimbApiKey);
// Invoke deleted method to delete recording Url
client.getRecordingsRequester.delete (recordingId);
} catch (FreeClimbException ex) {
// Exception throw upon failure
System.Console.WriteLine(ex.Message);
}
Updated about 1 month ago