Ravi J
Ravi J

Reputation: 107

Name details from extension in RingCentral API

In RingCentral, if we have 2-3 different extensions, what is the best API call to get the name and details of all the available extensions?

For example, if the 2 extensions are 101 and 103, where 101 belongs to John and 103 to Peter, what API call will give all these details?

Can be done with Node.js? Any reference? I am searching for reference all over for Node.js, but no luck. Not much details

Upvotes: 1

Views: 71

Answers (1)

Anirban Sen Chowdhary
Anirban Sen Chowdhary

Reputation: 8311

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

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

For Node js coding example:

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

Reference is taken from here:

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

Upvotes: 1

Related Questions