question

RPA_Hire RPA_Hire avatar image
RPA_Hire RPA_Hire asked Phong Vu answered

How can I get a department in GetExtensionList API?

I want department name in "GetExtension" API

how can I get department in "GetExtension" API

rest apiextension
1 |3000

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

1 Answer

Phong Vu avatar image
Phong Vu answered

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) 
1 |3000

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

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys