RingCentral API中扩展名的详细信息

时间:2020-09-19 12:50:03

标签: ringcentral

在RingCentral中,如果我们有2-3个不同的扩展名,那么什么是获取名称和所有可用扩展名的详细信息的最佳API调用是什么?

例如,如果2个扩展名分别是101和103,其中101属于John,而103属于Peter,那么哪个API调用将提供所有这些详细信息?

可以用Node.js完成吗?有参考吗?我一直在寻找Node.js的参考,但是没有运气。没有太多细节

1 个答案:

答案 0 :(得分:1)

您可以使用获取扩展名列表API来获取记录数组中的所有扩展名详细信息。

ref:https://developers.ringcentral.com/api-reference/Extensions/listExtensions

对于Node js编码示例:

var SDK = require('ringcentral
RINGCENTRAL_CLIENTID = 'your-app-client-id'
RINGCENTRAL_CLIENTSECRET = 'your-app-client-secret'
RINGCENTRAL_SERVER = 'https://platform.devtest.ringcentral.com'
RINGCENTRAL_USERNAME = 'your username'
RINGCENTRAL_PASSWORD = 'your password'
RINGCENTRAL_EXTENSION = '101'
 
var rcsdk = new SDK({
      server: RINGCENTRAL_SERVER,
      appKey: RINGCENTRAL_CLIENTID,
      appSecret: RINGCENTRAL_CLIENTSECRET
  });
var platform = rcsdk.platform();
platform.login({
      username: RINGCENTRAL_USERNAME,
      password: RINGCENTRAL_PASSWORD,
      extension: RINGCENTRAL_EXTENSION
      })
      .then(function(resp) {
          read_user_info
      });
 
function read_user_info(){
    platform.get('/account/~/extension')
        .then(function (resp) {
          var jsonObj = resp.json()
          for (var record of jsonObj.records){
            console.log(JSON.stringify(record))
            console.log("======")
          }
        })
        .catch(function(e){
          console.log(e.message)
        });
}

参考来自这里:

https://community.ringcentral.com/questions/9528/listing-the-extension-details.html