Call Log Quick Start
Calling the RingCentral API for the first time? We recommend you try out getting started experience.
In this quick start, we are going to help you access your company's call log, or a detailed audit of all the calls that have been routed through your account. Let's get started.
Create an app and obtain credentials
The first thing we need to do is create an app in the RingCentral Developer Console. This can be done quickly by clicking the "Create Call Log App" button below. Just click the button, enter a name and description if you choose, and click the "Create" button. If you do not yet have a RingCentral account, you will be prompted to create one.
Create Call Log App Show detailed instructions
- Login or create an account if you have not done so already.
- Go to Console/Apps and click 'Create App' button.
- Select "REST API App" under "What type of app are you creating?" Click "Next."
- Under "Auth" select "JWT auth flow."
- Under "Security" add the following permissions:
- Read Call Log
- Under "Security" select "This app is private and will only be callable using credentials from the same RingCentral account."
When you are done, you will be taken to the app's dashboard. Make note of the Client ID and Client Secret. We will be using those momentarily.
Download and edit a .env
file
Follow the instructions found in our guide to running Developer Guide code samples. Or:
- Download our env-template and save it as a file named
.env
. - Edit your newly downloaded
.env
file, setting its variables with the proper values for the app you created above, paying close attention to the following:RC_APP_CLIENT_ID
- set to the Client ID of the app you created aboveRC_APP_CLIENT_SECRET
- set to the Client Secret of the app you created aboveRC_USER_JWT
- set to the JWT credential you created for yourself
Access your company's call log
const RC_SDK = require('@ringcentral/sdk').SDK
const path = require('path')
// Remember to modify the path of your .env file location!
require('dotenv').config({ path: path.resolve(__dirname, '../.env') })
// Instantiate the SDK and get the platform instance
var rcsdk = new RC_SDK({
'server': process.env.RC_SERVER_URL,
'clientId': process.env.RC_APP_CLIENT_ID,
'clientSecret': process.env.RC_APP_CLIENT_SECRET
});
var platform = rcsdk.platform();
/* Authenticate a user using a personal JWT token */
platform.login({ 'jwt': process.env.RC_USER_JWT })
platform.on(platform.events.loginSuccess, function(e){
read_user_calllog()
});
platform.on(platform.events.loginError, function(e){
console.log("Unable to authenticate to platform. Check credentials.", e.message)
process.exit(1)
});
/*
* Read user call log between a period of time
*/
async function read_user_calllog() {
try {
var queryParams = {
'dateFrom': "2024-01-01T00:00:00.000Z",
'dateTo': "2024-01-31T23:59:59.009Z",
'view': "Detailed"
}
var endpoint = "/restapi/v1.0/account/~/extension/~/call-log"
var resp = await platform.get(endpoint, queryParams)
var jsonObj = await resp.json()
for (var record of jsonObj.records)
console.log(record)
} catch (e) {
console.log("Unable to read user call log.", e.message)
}
}
from ringcentral import SDK
import os,json
from dotenv import load_dotenv
load_dotenv()
#
# Read user call log between a period of time
#
def read_user_calllog():
try:
queryParams = {
'dateFrom': "2024-01-01T00:00:00.000Z",
'dateTo': "2024-01-31T23:59:59.009Z",
'view': "Detailed"
}
endpoint = "/restapi/v1.0/account/~/extension/~/call-log"
resp = platform.get(endpoint, queryParams)
jsonObj = resp.json_dict()
for record in jsonObj['records']:
print(json.dumps(record, indent=2, sort_keys=True))
except Exception as e:
print ("Unable to read user call log. " + str(e))
# Instantiate the SDK and get the platform instance
rcsdk = SDK( os.environ.get('RC_APP_CLIENT_ID'),
os.environ.get('RC_APP_CLIENT_SECRET'),
os.environ.get('RC_SERVER_URL') )
platform = rcsdk.platform()
# Authenticate a user using a personal JWT token
def login():
try:
platform.login( jwt=os.environ.get('RC_USER_JWT') )
read_user_calllog()
except Exception as e:
sys.exit("Unable to authenticate to platform. Check credentials." + str(e))
login()
<?php
// Remember to modify the path ./../ pointing to the location where the RingCentral SDK was installed and the .env file was saved!
require('./../vendor/autoload.php');
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . './../');
$dotenv->load();
# Instantiate the SDK and get the platform instance
$rcsdk = new RingCentral\SDK\SDK( $_ENV['RC_APP_CLIENT_ID'],
$_ENV['RC_APP_CLIENT_SECRET'],
$_ENV['RC_SERVER_URL'] );
$platform = $rcsdk->platform();
// Authenticate a user using a personal JWT token
try {
$platform->login( [ "jwt" => $_ENV['RC_USER_JWT'] ] );
read_user_calllog();
} catch (\RingCentral\SDK\Http\ApiException $e) {
exit("Unable to authenticate to platform. Check credentials. " . $e->message . PHP_EOL);
}
/*
* Read user call log between a period of time
*/
function read_user_calllog() {
global $platform;
try{
$queryParams = array(
'dateFrom' => "2024-01-01T00:00:00.000Z",
'dateTo' => "2024-01-31T23:59:59.009Z",
'view' => "Detailed"
);
$endpoint = "/restapi/v1.0/account/~/extension/~/call-log";
$resp = $platform->get($endpoint, $queryParams);
foreach ($resp->json()->records as $record) {
print_r (json_encode($record, JSON_PRETTY_PRINT));
}
}catch (\RingCentral\SDK\Http\ApiException $e) {
print_r ("Unable to read user call log. " . $e->getMessage() . PHP_EOL);
}
}
?>
require 'ringcentral'
require 'dotenv/load'
# Remember to modify the path to where you saved your .env file!
Dotenv.load("./../.env")
#
# Read user call log between a period of time
#
def read_user_calllog()
begin
endpoint = "/restapi/v1.0/account/~/extension/~/call-log"
queryParams = {
'dateFrom': "2024-01-01T00:00:00.000Z",
'dateTo': "2024-01-31T23:59:59.009Z",
'view': "Detailed"
}
resp = $platform.get(endpoint, queryParams)
for record in resp.body['records'] do
puts JSON.pretty_generate(record)
end
rescue StandardError => e
puts ("Unable to read user call log. " + e.to_s)
end
end
# Instantiate the SDK and get the platform instance
$platform = RingCentral.new( ENV['RC_APP_CLIENT_ID'], ENV['RC_APP_CLIENT_SECRET'], ENV['RC_SERVER_URL'] )
# Authenticate a user using a personal JWT token
def login()
begin
$platform.authorize(jwt: ENV['RC_USER_JWT'])
read_user_calllog()
rescue StandardError => e
puts ("Unable to authenticate to platform. Check credentials." + e.to_s)
end
end
login()
using System;
using System.IO;
using System.Threading.Tasks;
using System.Collections.Generic;
using RingCentral;
using Newtonsoft.Json;
using dotenv.net;
namespace Read_User_CallLog
{
class Program
{
static RestClient restClient;
static async Task Main(string[] args)
{
try
{
DotEnv.Load();
// Instantiate the SDK
restClient = new RestClient(
Environment.GetEnvironmentVariable("RC_APP_CLIENT_ID"),
Environment.GetEnvironmentVariable("RC_APP_CLIENT_SECRET"),
Environment.GetEnvironmentVariable("RC_SERVER_URL"));
// Authenticate a user using a personal JWT token
await restClient.Authorize( Environment.GetEnvironmentVariable("RC_USER_JWT") );
await read_user_calllog();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
/*
* Read user call log between a period of time
*/
static private async Task read_user_calllog()
{
try
{
var queryParams = new ReadUserCallLogParameters();
queryParams.dateFrom = "2024-01-01T00:00:00.000Z";
queryParams.dateTo = "2024-01-31T23:59:59.009Z";
queryParams.view = "Detailed";
var resp = await restClient.Restapi().Account().Extension().CallLog().List(queryParams);
foreach (CallLogRecord record in resp.records)
{
Console.WriteLine(JsonConvert.SerializeObject(record, Formatting.Indented));
}
}
catch (Exception ex)
{
Console.WriteLine("Cannot read user call log data. " + ex.Message);
}
}
}
}
package UserCallLogQuickStart;
import java.io.IOException;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.ringcentral.*;
import com.ringcentral.definitions.*;
public class UserCallLogQuickStart {
static RestClient restClient;
public static void main(String[] args) {
var obj = new UserCallLogQuickStart();
try {
// Instantiate the SDK
restClient = new RestClient(System.getenv("RC_APP_CLIENT_ID"), System.getenv("RC_APP_CLIENT_SECRET"), System.getenv("RC_SERVER_URL"));
// Authenticate a user using a personal JWT token
restClient.authorize(System.getenv("RC_USER_JWT"));
obj.read_user_calllog();
} catch (RestException e) {
System.out.println("Unable to authenticate to platform. Check error: " + e.getMessage());
} catch (IOException e) {
e.printStackTrace();
}
}
/*
* Read user call log between a period of time
*/
public void read_user_calllog() throws RestException, IOException{
try {
var queryParams = new ReadUserCallLogParameters();
queryParams.dateFrom = "2024-01-01T00:00:00.000Z";
queryParams.dateTo = "2024-01-31T23:59:59.009Z";
queryParams.view = "Detailed";
var response = restClient.restapi().account().extension().callLog().list(queryParams);
for (var record : response.records) {
String jsonStr = new Gson().toJson(record, new TypeToken<Object>(){}.getType());
System.out.println(jsonStr);
}
}catch (RestException e){
System.out.println("Unable to read user call log data. " + ex.getMessage());
}
}
}