News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
Needs Advice on List User Call Records API
Tags: call logs
Nov 28, 2023 at 11:32am   •   1 replies  •  0 likes
Hazel Vu

Hello Ring Central Community,

I am very new to getting data via API but I do have a working script that successfully retrieve our company's call data in the format I wanted. Now my next obstacle is that perPage parameter only allows a maximum of 250 records returned for Detailed view.

Is there a way to retrieve more than 250 records?

If there is no way to retrieve more than 250 records, what is the best practices from here? I reviewed Ring Central Data Archival but because we don't have a database, I am not sure what to do. We have AWS S3 but currently it is not being used for company reporting. Should we set up an S3 bucket for this?

I am also not sure how often the API supposed to be called? Do I need to figure out on average how many coming through every hour and schedule the script to retrieve and append data every hour? What if there is an influx of incoming call and there are more than 250 calls during that certain hour?

Thank you in advance for any help or guidance you can provide!

1 Answer
answered on Nov 28, 2023 at 1:30pm  

You can use the pagination value to navigate thru the pages (which each page contains 250 records).

Here is an example how to read the account call log using the RingCentral JS SDK

async function read_account_calllog(){
  var queryParams = {
    dateFrom: "2023-11-01T16:42:12.577Z",
    dateTo: "2023-11-05T16:42:12.577Z",
    view: "Detailed",
    perPage: 250
  }
  try {
    var resp = await platform.get('/restapi/v1.0/account/~/call-log', queryParams)

    var jsonObj = await resp.json()
    
    for (var record of jsonObj.records){
        // parse record and save it to your db
        console.log(JSON.stringify(record))
        console.log("======= ^^^^^ ========")
    }
    // Check if there are next pages
    var navigationObj = jsonObj.navigation
    if (navigationObj.hasOwnProperty("nextPage")){
      read_calllog_nextpage(navigationObj.nextPage.uri)
    }else{
        console.log("no next page. Done")
    }
  }catch(e){
    console.log(e.message)
  }
}

async function read_calllog_nextpage(url){
  try {
    var resp = await platform.get(url)
    var jsonObj = await resp.json()
    for (var record of jsonObj.records){
        // parse record and save it to your db
        console.log(JSON.stringify(record))
        console.log("======= ^^^^^ ========")
    }
    // Check if there are next pages
    var navigationObj = jsonObj.navigation
    if (navigationObj.hasOwnProperty("nextPage")){
        read_calllog_nextpage(navigationObj.nextPage.uri)
      }else{
        console.log("no more next page. Done")
      }
    } catch (e){
      console.log(e.message)
    }
}

You can combine the 2 functions into one and handle the queryParams accordingly.


 0
on Dec 29, 2023 at 10:25am   •  0 likes

Hi Phong,

Thank you so much for your guidance! I was able to replicate the example code using the RingCentral Python SDK.



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us