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!
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.
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