Skip to main content

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?

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)
});
}



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



Reply