すべての通話の情報を取得する
全コールの情報を取得する方法を示すコード・スニペット。
例
Prerequisites
Execute the following command at your terminal prompt to create the JWT for authentication:
Run your code
Save this file to your machine and run it:
Prerequisites
Create a file named retrieve-info-for-all-calls.js and add the following code:
Run your code
Save this file to your machine and run it:
Prerequisites
Add the following to build.gradle:
Create a class named RetrieveInfoForAllCalls and add the following code to the main method:
val client = Vonage {
applicationId(VONAGE_APPLICATION_ID)
privateKeyPath(VONAGE_PRIVATE_KEY_PATH)
}Write the code
Add the following to the main method of the RetrieveInfoForAllCalls class:
val now = Instant.now()
val yesterday = now.minus(Duration.ofDays(1))
val calls = client.voice.listCalls {
startDate(yesterday)
endDate(now)
}
calls.callInfos.forEach {
println(it.toJson())
}Run your code
We can use the アプリケーション plugin for Gradle to simplify the running of our application. Update your build.gradle with the following:
Run the following gradle command to execute your application, replacing com.vonage.quickstart.kt.voice with the package containing RetrieveInfoForAllCalls:
Prerequisites
Add the following to build.gradle:
Create a class named RetrieveInfoForAllCalls and add the following code to the main method:
Write the code
Add the following to the main method of the RetrieveInfoForAllCalls class:
Run your code
We can use the アプリケーション plugin for Gradle to simplify the running of our application. Update your build.gradle with the following:
Run the following gradle command to execute your application, replacing com.vonage.quickstart.voice with the package containing RetrieveInfoForAllCalls:
Prerequisites
Prerequisites
Run your code
Save this file to your machine and run it:
Prerequisites
Run your code
Save this file to your machine and run it:
Prerequisites
Run your code
Save this file to your machine and run it:
試してみる
サンプルコードを実行して、すべてのコールの情報を取得する。