question

David Radabaugh avatar image
David Radabaugh asked Suyash Joshi answered

Analytics API Data Source

Hello,

I'm trying to use the analytics API to create some useful performance metrics for our users, but the data isn't matching what I would expect so it would help to understand where it's coming from.

For example, I have an API call that uses callsByResponseType, but when I evaluate the results against the call log, they don't match. For example, I have someone who, according to the analytics API, answered 22 call queues last month. However, looking at the call log I can see at least 40 that they answered.

I'd like to figure out how the API calculates those totals so I can figure out what's causing the discrepancies.

Thank you!

rest apianalytics and reporting
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Suyash Joshi avatar image
Suyash Joshi answered

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.

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Suyash Joshi avatar image
Suyash Joshi answered

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/

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

David Radabaugh avatar image
David Radabaugh answered David Radabaugh published

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 = @"{" + "\n" +
            @"  ""grouping"": {" + "\n" +
            @"    ""groupBy"": ""Users""" + "\n" +
            @"  }," + "\n" +
            @"  ""timeRange"": {" + "\n" +
            //@"    ""timeFrom"": """ + startOfMonth + @"""," + "\n" +
            //@"    ""timeTo"": """ + curDT + @"""" + "\n" +
            @"    ""timeFrom"": ""2021-09-01T06:00:00.000Z""," + "\n" +
            @"    ""timeTo"": ""2021-10-01T00:00:01.000Z""" + "\n" +
            @"  }," + "\n" +
            @"  ""responseOptions"": {" + "\n" +
            @"    ""counters"": {" + "\n" +
            @"      ""callsByResponseType"" : {" + "\n" +
            @"          ""aggregationType"": ""Sum""" + "\n" +
            @"      }" + "\n" +
            @"    " + "\n" +
            @"    }" + "\n" +
            @"  }" + "\n" +
            @"}";
            request.AddParameter("application/json", body, ParameterType.RequestBody);
            IRestResponse response = client.Execute(request);
            return response.Content;
        }
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Suyash Joshi avatar image
Suyash Joshi answered

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.

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

David Radabaugh avatar image
David Radabaugh answered Suyash Joshi commented

Hello Suyashi. Matching the times does not change the results. Users do not receive calls during those hours.

1 comment
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Suyash Joshi avatar image Suyash Joshi ♦ commented ·

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?

0 Likes 0 ·
Suyash Joshi avatar image
Suyash Joshi answered

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!


1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys