Skip to main content
Solved

How can I get a department in GetExtensionList API?

  • 23 February 2022
  • 1 reply
  • 234 views

I want department name in "GetExtension" API

how can I get department in "GetExtension" API

1 reply

Userlevel 2
Badge

Read the extension info using the Get Extension API. If the extension belongs to one or more departments, the response will contain an array or departments. Read each department with the id or using the URI in each attachment object to get details of that department.

async function read_user_info(extensionId) {
  try{
    var resp = await platform.get(`/restapi/v1.0/account/~/extension/${extensionId}`)
    var jsonObj = await resp.json
    console.log("===========")
    console.log(jsonOb
  }catch(e){
    console.log(e.message)
  }
}

// E.g. response with departments array
 ...
 departments: [
    {
      uri: 'https://platform.ringcentral.com/restapi/v1.0/account/80964xxxx/extension/6237675xxxx',
      id: '6237675xxxx',
      extensionNumber: '11603'
    },
    {
      uri: 'https://platform.ringcentral.com/restapi/v1.0/account/80964xxxx/extension/6237675xxxx',
      id: '6237675xxxx',
      extensionNumber: '12002'
    },
...
// Now call the function again to get department's details
read_user_info(6237675xxxx) 

Reply