简体   繁体   English

将 RingCentral 通话记录导出为 CSV 的方法

[英]Ways to export RingCentral call log as CSV

Call log record can be obtain using RingCentral API and can be filtered using date To ( dateTo ) and From ( dateFrom ).通话记录可以使用 RingCentral API 获取,并且可以使用日期To ( dateTo ) 和From ( dateFrom ) 进行过滤。

I have went through the API Reference to get call log with API here .我已经通过 API 参考来获取 API 通话记录。

We can see the following API is used to get all the call log record:我们可以看到下面的 API 是用来获取所有通话记录的:

https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~/call-log https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~/call-log

But we need to export this log something in CSV format file.但是我们需要在 CSV 格式文件中导出这个日志。 What is the way we can do it in a file and save it on local disc?我们可以在文件中执行此操作并将其保存在本地磁盘上的方式是什么?

I haven't got that in any official docs.我在任何官方文档中都没有。

There are many ways to do it.有很多方法可以做到这一点。 If you check this reference here you will see, it is suggested to log into RingCentral Online Account Portal ( https://service.ringcentral.com ) as an admin view your Call Log data, and download each page into one single csv.如果您在此处查看此参考资料,您将看到,建议以管理员身份登录 RingCentral 在线帐户门户( https://service.ringcentral.com )查看您的通话记录数据,并将每个页面下载到一个 Z6287CB5675FFE828FEAAFE

Another reference here suggest to use a programming language to call the call log API and save it as local file. 这里的另一个参考建议使用编程语言调用调用日志 API 并将其保存为本地文件。

example, with Node JS and can run it locally on your machine.例如,使用 Node JS 并可以在您的机器上本地运行它。 All you need to do is need to login the developer portal and create an app with the read call log permission.您需要做的就是登录开发者门户并创建一个具有读取通话记录权限的应用程序。 App platform type will be Server only (no UI).应用平台类型将是仅服务器(无 UI)。 Client ID and Client Secret can be used in the sample code in the link given. Client ID 和Client Secret可以在给出的链接中的示例代码中使用。

code snippet:代码片段:

platform.get('/account/~/extension/~/call-log', params)
.then(function(resp){
var json = resp.json()
  if (json.records.length > 0){
    var fs = require('fs')
      var cvs = 'uri,startTime,duration,type,direction,action,result,to_name,from_name,transport'
      for (var record of json.records){
        //console.log(JSON.stringify(record))
        cvs += "\r\n"
       cvs += record.uri + ','
       cvs += record.startTime + ','
        cvs += record.duration + ','
        cvs += record.type + ','
      cvs += record.direction + ','
      cvs += record.action + ','
       cvs += record.result + ','
        if (record.to.hasOwnProperty('name'))
          cvs += record.to.name + ','
       else
         cvs += 'null,'
      if (record.hasOwnProperty('from')){
         if (record.from.hasOwnProperty('name'))
            cvs += record.from.name + ','
          else
            cvs += 'null,'
       }else
       cvs += 'null,'
       cvs += record.transport

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM