Skip to main content
Solved

How can I get a department in GetExtensionList API?

  • February 23, 2022
  • 1 reply
  • 235 views

I want department name in "GetExtension" API

how can I get department in "GetExtension" API

Best answer by PhongVu

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) 
View original
Did this thread help you find an answer to your question?

1 reply

PhongVu
Community Manager
Forum|alt.badge.img
  • Community Manager
  • 2313 replies
  • Answer
  • February 23, 2022

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings