Exporting Call Log Data

  • 1
  • Question
  • Updated 2 years ago
  • Answered
  • (Edited)
I have successfully retrieved both simple and detailed call log records from API calls. However, I am interested in obtaining every call log to store in our database. This would allow us to limit the amount of needed calls to the Ring Central API and the data would be much more accessible. 

I have already come to the conclusion that Ring Central does not provide any sort of Data Migration (To our sandbox for example) from this post https://devcommunity.ringcentral.com/ringcentraldev/topics/get-company-call-statistics-in-sandbox

Although the API returns data in a JSON format, does Ring Central provide any sort of data export (csv ...)? 

I ask this because of the "perPage" limit on the call log request. This looks to be set to a maximum of 1000 even if passed a greater value. Can this limit be increased?

It is possible for us to write a script to call for these logs from the last several months and record the data from each call, so this is just a question, however if either of the options above are available it would greatly help speed up this process. 

EDIT:  Before this was answered I thought I would add another related question. When requesting call log data via the API I can only retrieve up to a certain date where as here https://service.ringcentral.com I am able to go back much further, is there a date/data limit to the call log request?

Thanks,
Connor  
Photo of Connor Blakely

Connor Blakely

  • 202 Points 100 badge 2x thumb

Posted 2 years ago

  • 1
Photo of Benjamin Dean

Benjamin Dean, Alum

  • 8,622 Points 5k badge 2x thumb
There are a couple of ways you can get your Call Log data (keeping in mind RingCentral does not store call logs or recordings indefinitely).

1. Use the RingCentral Online Account Portal (https://service.ringcentral.com) as an admin, view your Call Log data, and download each page (concatenating the data into a single .csv). This is prone to human error and not a very "developer" way of doing things.

2. Using the RingCentral Connect Platform and Call Log resource of our API.

To help you along your way, I have created this demo application which downloads call logs from your account (when logged in as an admin-level user) and converts them to CSV format, then writes it to disk on your local machine.

This is just demo code, but it operates at a basic level, and you can expand as you like (add any issues, and Star/Fork/Watch the repository if you like it and would enjoy contributing to it):

https://github.com/bdeanindy/ringcentral-call-log-download-demo
(Edited)
Photo of Connor Blakely

Connor Blakely

  • 202 Points 100 badge 2x thumb
Hey Benjamin, 

Once again, thanks for the quick response. I will take a look at the git repo and respond here as soon as I have new info. 

Thanks!
Photo of John Wang

John Wang, Official Rep

  • 5,278 Points 5k badge 2x thumb
I ask this because of the "perPage" limit on the call log request. This looks to be set to a maximum of 1000 even if passed a greater value. Can this limit be increased?
1000 is the max perPage setting. If there are more than 1000 records, you will be able to call the nextPage in a URL that's provided in the API response paging property.

An approach you can use to reduce the number of pages is to narrow the scope of your query. For example, if you have 1000 records per day, you can set dateFrom and dateTo to a 1 day range for the following using ISO 8601 dates:
  • dateFrom = 2016-07-01T00:00:00Z
  • dateTo = 2016-07-01T23:59:59Z
Then you can make a separate request per day. You can adjust this as fitting for your call volume and download use case.
Photo of Connor Blakely

Connor Blakely

  • 202 Points 100 badge 2x thumb
Hey John, 

Thanks for the clarification on the "perPage"setting.
Photo of Benjamin Dean

Benjamin Dean, Alum

  • 8,622 Points 5k badge 2x thumb
I hope that Node.js application I provided helps. It addresses the items which John has indicated above and allows you to set them as environment variables while exporting the data. It will recursively grab all the records between the dateFrom and dateTo of callLogs and convert them into a CSV.

If you have more than 10K call logs to download, it will need an improvement to delay subsequent requests according to the "reply-after" header you'll receive in the 429 response header (as seconds) since Call Log is a "Heavy" Usage Plan API which limits your requests to 10 per minute.
(Edited)
Photo of Connor Blakely

Connor Blakely

  • 202 Points 100 badge 2x thumb
Hey Benjamin, 

I have had no issue installed node and cloning your repo. 

When I currently run npm start I receive the following:
 LOGIN FAILURE DATA:  { [Error: Access Denied.]

With that, I have two questions. First, the url specified in the response data is url: 'https://platform.devtest.ringcentral.com/restapi/oauth/token', but I assume this should be platform.ringcentral as I am using production credentials for production call logs?

When RC_API_BASE_URL=https://platform.ringcentral.com I still receive the same error message. 

Second, in .env I set RC_APP_SECRET to an access token I retrieve with our production credentials prior to running npm start. Does this sound correct?

EDIT: This is the current response
Server is listening on port:  3000
LOGIN FAILURE DATA:  { [Error: Access Denied.]
  apiResponse: 
   { _request: 
      { method: 'POST',
        redirect: 'follow',
        headers: [Object],
        url: 'https://platform.ringcentral.com/restapi/oauth/token',
        follow: 20,
        compress: true,
        counter: 0,
        agent: undefined,
        body: 'grant_type=password&username=...&password=...&extension=...',
        bodyUsed: false,
        size: 0,
        timeout: 0,
        _raw: [],
        _abort: false,
        protocol: 'https:',
        hostname: 'platform.ringcentral.com',
        port: null,
        path: '/restapi/oauth/token',
        auth: null,
        originalBody: 'grant_type=password&username=...&password=...&extension=...' },
     _response: 
      { url: 'https://platform.ringcentral.com/restapi/oauth/token',
        status: 400,
        statusText: 'Bad Request',
        headers: [Object],
        ok: false,
        body: [Object],
        bodyUsed: true,
        size: 0,
        timeout: 0,
        _raw: [Object],
        _abort: false,
        _bytes: 77 },
     _text: '{\r\n  "error" : "invalid_client",\r\n  "error_description" : "Access Denied."\r\n}',
     _json: { error: 'invalid_client', error_description: 'Access Denied.' },
     _multipart: [] },
  originalMessage: 'Response has unsuccessful status' }
ERROR:  { [Error: Access Denied.]
  apiResponse: 
   { _request: 
      { method: 'POST',
        redirect: 'follow',
        headers: [Object],
        url: 'https://platform.ringcentral.com/restapi/oauth/token',
        follow: 20,
        compress: true,
        counter: 0,
        agent: undefined,
        body: 'grant_type=password&username=...&password=...&extension=...',
        bodyUsed: false,
        size: 0,
        timeout: 0,
        _raw: [],
        _abort: false,
        protocol: 'https:',
        hostname: 'platform.ringcentral.com',
        port: null,
        path: '/restapi/oauth/token',
        auth: null,
        originalBody: 'grant_type=password&username=...&password=...&extension=...' },
     _response: 
      { url: 'https://platform.ringcentral.com/restapi/oauth/token',
        status: 400,
        statusText: 'Bad Request',
        headers: [Object],
        ok: false,
        body: [Object],
        bodyUsed: true,
        size: 0,
        timeout: 0,
        _raw: [Object],
        _abort: false,
        _bytes: 77 },
     _text: '{\r\n  "error" : "invalid_client",\r\n  "error_description" : "Access Denied."\r\n}',
     _json: { error: 'invalid_client', error_description: 'Access Denied.' },
     _multipart: [] },
  originalMessage: 'Response has unsuccessful status' }

Thanks again, 
Connor 
(Edited)
Photo of John Wang

John Wang, Official Rep

  • 5,278 Points 5k badge 2x thumb
Connor, since this question is specifically for the demo app on GitHub, it would be useful to post the above as a GitHub issue here:

https://github.com/bdeanindy/ringcentral-call-log-download-demo/issues

This way more people using the app can see the issue, contribute to it and benefit from it.

Thanks.
(Edited)
Photo of Benjamin Dean

Benjamin Dean, Alum

  • 8,622 Points 5k badge 2x thumb
Thanks John, I have answered this question here: https://github.com/bdeanindy/ringcentral-call-log-download-demo/issues/2