Solved

API Update/Replace Extension/User: How to remove values?

  • 14 September 2020
  • 2 replies
  • 465 views

I could not figure out a way to remove values from extensions contact information using the API.

Both Update Extension and Update/Replace User seem to not offer the functionality to remove values, e.g. the mobile phone number.

This is a common use case in our company, people having a mobile number migration to VOIP and therefore loose the mobile number. In such a case an automated process should remove the mobile number from the contact information.

I tried sending empty value (with " and without), sending null.

While everthing that is not a valid number returns a validation error, sending null (which I would have expected to be the right way as specified in JSON) does not send an error, but does not have an effect at all.

So how can I remove contact information using the API call?

icon

Best answer by Phong1426275020 14 September 2020, 16:38

View original

2 replies

Userlevel 1

Just make a PUT call to this endpoint with the "mobilePhone":"".

See the example code below

// Use the RingCentral JS SDK
var p = { contact: { mobilePhone: ""}})
try{
  var r = await platform.put('/restapi/v1.0/account/~/extension/[extensionId]', p)
  var jsonObj = await r.json()
  console.log(JSON.stringify(jsonObj
}catch(e){
    console.log(e.message)
}


Indeed, that worked. I had the impression I have tested everything without any positive result, looks like I have overseen the simplest option. Thanks!

Reply