News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
Unassigned Extensions
Tags: rest api
May 26, 2020 at 11:40am   •   2 replies  •  0 likes
Mike Robinson

Hello - is there a method to assign an unassigned extension to a user via the API? I tried 2 methods and neither worked so I am curious if I am doing something wrong or if there just isn't a way to do this yet.

I first tried using 'Update Device': https://platform.devtest.ringcentral.com/restapi/v1.0/account/accountId/device/deviceId
I used a deviceId of an unassigned extension and passed in the extension id of an existing user. This method resulted in the following error: "Unknown device update use case".

I then tried using 'Update Extension': https://platform.devtest.ringcentral.com/restapi/v1.0/account/accountId/extension/extensionId
I used the extensionId of an unassigned extension, and passed in the user contact information (the user did not exist in RC). The API request went through, but when I went to look in RC, the extension was still in the 'Unassigned Extensions' section and when I clicked on the link, it brought up a read-only page showing the contact info I added to the extension but nothing could be updated. I had to assign the extension to someone else manually to get the extension out of the 'Unassigned' list.

Any help/thoughts would be appreciated - thank you!


2 Answers
answered on May 29, 2020 at 11:41am  

Appreciate the response Phong! Node is just fine - that is the same function call I used but our params don't quite match up, so I will try it again and report back.


 0
answered on May 27, 2020 at 11:51am  

Here is how you can assign an unassigned extension. I assumed that you can read and use Node JS and RingCentral JS SDK. But if not, let me know.

function find_unassigned_extensions(){
    platform.get('/account/~/extension')
        .then(function (resp) {
          var jsonObj = resp.json()
          for (var record of jsonObj.records){
            if (record.type == "User" && record.status == "Unassigned"){
              //console.log(JSON.stringify(record))
              //console.log("======")
              if (record.id == "260981XXX"){ // The extension you want to assi
                assign_this_extension_to_a_new_user(record.id)
              }
            }
          }
        })
        .catch(function(e){
          console.log(e.message)
        });
}

function assign_this_extension_to_a_new_user(extId){
  var params = {
    status: "Enabled",
    extensionNumber: 202, // leave this or make sure the number are not being used
    contact: {
      firstName: "Demo",
      lastName: "Automated",
      company: "Test",
      jobTitle: "consultant",
      email: "valid.email@address.com",
      emailAsLoginName: true
    },
    password: "some-password"
  }
  platform.put('/account/~/extension/' + extId, params)
      .then(function (resp) {
        var jsonObj = resp.json()
        console.log(jsonObj)
      })
      .catch(function(e){
        console.log(e.message)
      });
}



 0



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us