Hi David, This is a great question and certainly you can get similar metrics from both of these APIs. I'm curious what your HTTP POST JSON Body looks like to understand how you are setting up the query. The data should be same if all things are equal. Do note that the Analytics API is mostly high level where it shows aggregate information. Btw are you in our beta team ? I can tag you and our PMs to discuss this further, otherwise we can communicate here. You can also email me suyash.joshi@ringcentral.com and we can setup a 30 min meeting if needed.
Hi David, thanks for the patience, after some investigation here is what I have found regarding your problem. One cannot match calls by response types to total calls because outbound calls do not have responses & that gap will always cause discrepancy as such calls will not get counted.
Regarding your use case for being able to see the number of calls each user picked up directly from a queue- the API can provide that information. Please see the latest API Docs for the same : https://ringcentral-call-performance.readthedocs-hosted.com/en/latest/
Hello,
I'm aware that outbound calls do not have responses. My concern is that the numbers from the Analytics API do not seem to match the numbers in the call log.
For example, according to the analytics API, one user answered 22 calls from queues. However, according to the rest API call log (which I have filtered to exclusively inbound calls), he has answered at least 37 queue calls.
I want to know why there is a discrepancy between the call log and the analytics API.
call to the call log
private static string callLog(string _bToken)
{
var client = new RestClient("https://platform.ringcentral.com/restapi/v1.0/account/~/extension/" + user_acc + "/call-log?dateFrom=2021-09-01T00:00:00.000Z&dateTo=2021-09-02T00:00:00.000Z&perPage=2000&direction=Inbound");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Accept", "application/json");
request.AddHeader("Authorization", _bToken);
var body = @"";
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
return response.Content;
}
call to the analytics API
private static string analyticsResp(string _bToken)
{
DateTime dt = DateTime.Now;
string startOfMonth = new DateTime(dt.Year, dt.Month, 1, 7, 0, 0).ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffZ");
string curDT = dt.AddDays(1).ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffZ");
var client = new RestClient("https://platform.ringcentral.com/analytics/phone/performance/v1/accounts/~/calls/aggregate/");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Accept", "application/json");
request.AddHeader("Authorization", _bToken);
var body = @"{" + "
" +
@" ""grouping"": {" + "
" +
@" ""groupBy"": ""Users""" + "
" +
@" }," + "
" +
@" ""timeRange"": {" + "
" +
//@" ""timeFrom"": """ + startOfMonth + @"""," + "
" +
//@" ""timeTo"": """ + curDT + @"""" + "
" +
@" ""timeFrom"": ""2021-09-01T06:00:00.000Z""," + "
" +
@" ""timeTo"": ""2021-10-01T00:00:01.000Z""" + "
" +
@" }," + "
" +
@" ""responseOptions"": {" + "
" +
@" ""counters"": {" + "
" +
@" ""callsByResponseType"" : {" + "
" +
@" ""aggregationType"": ""Sum""" + "
" +
@" }" + "
" +
@" " + "
" +
@" }" + "
" +
@" }" + "
" +
@"}";
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
return response.Content;
}
Thanks for sharing the code snippets David. Please note the time discrepency in the two API calls - Call Performance Analytics one starts at 06:00:00.000Z vs Call Log one at 00:00:00.000Z. Can you make both of them same and compare the results again? We are also investigating this on our side and I'll reach out to your privately for some more information.
Hello Suyashi. Matching the times does not change the results. Users do not receive calls during those hours.
Ok, noticed the dates are also different. Can you run the code by changing it to match the date like Sep1 to Oct1 at the same time for both the APIs and report if you still see a significant discrepency?
Hi David, can you please respond to the email (sent by Tanvi) with more information about your request as we need that about your account to investigate and resolve this issue Thanks!