question

Chaitali avatar image
Chaitali asked ·

listing the extension details

We have multiple extension we are working with.

We want to list all the details of all the extension under the account. What is the best way to do that?

extension
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image
Phong Vu answered ·

First of all, your app must have the ReadAccounts permission. Then write your code to login with an admin user (e.g. the extension 101) and call the Get Extension List API. Here is some code snippet in 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 = 'maincompanynumber'
RINGCENTRAL_PASSWORD = 'user-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)
        });
}


Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Anirban Sen Chowdhary avatar image
Anirban Sen Chowdhary answered ·

You can use Get Extension List API to get all the extension details in an array of record:

Check the doc here: https://developers.ringcentral.com/api-reference/Extensions/listExtensions

So if you use GET https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension API

all the extension will be in array of record.

If you want to filter any particular extension details use: https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/{ extension id}

use extension id at the end, it will filter all the details of particular extension


Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.