question

Jackson Khan avatar image
Jackson Khan asked Jackson Khan commented

How do I use the API to assign phone number to an extension?

Hello,

I have multiple phone numbers in inventory. I want to be able to assign a phone number to an extension I created.


I tried this PATCH command, but it keeps saying the extensionID number is not found: https://developers.ringcentral.com/api-reference/Phone-Numbers/assignPhoneNumberV2


I even tried to do a get of the extension number I want to use, using this GET commad: https://developers.ringcentral.com/api-reference/Phone-Numbers/listExtensionPhoneNumbers


But it still can't find the extension number, it can only show me the results of all the extensions I have in my ringcentral account if I uses the tilde "~"


Is it possible to assign phone numbers to an user's extension? I want to be able to assign a phone number to an extension I created, and have that number be the primary fax and fax only number type.

phone numbers
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 Jackson Khan commented

Where did you get the extension id and make sure that it's valid.

Show me the code how you call the PATCH method to assign a number.

5 comments
1 |3000

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

Jackson Khan avatar image Jackson Khan commented ·

Is the extension number itself the extensionID? For example, when I GET info for an account, this is the response:


{
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:ListResponse"
  ],
  "totalResults": 1,
  "startIndex": 1,
  "itemsPerPage": 100,
  "Resources": [
    {
      "schemas": [
        "urn:ietf:params:scim:schemas:core:2.0:User"
      ],
      "id": "63548308004",
      "meta": {
        "resourceType": "User",
        "created": "2023-11-15T19:17:30.342Z",
        "lastModified": "2023-11-15T19:17:30.342Z",
        "location": "https://platform.ringcentral.com/scim/v2/Users/63548308004"
      },
      "userName": "test.user15@wellthy.com",
      "name": {
        "formatted": "Test User15",
        "familyName": "User15",
        "givenName": "Test"
      },
      "active": true,
      "emails": [
        {
          "value": "test.user15@wellthy.com",
          "type": "work"
        }
      ],
      "phoneNumbers": [
        {
          "value": "326",
          "type": "other"
        }
      ]
    }
  ]
}

So is "326" the extenstion ID? Because when I try to do a get extension phone number list, it gives a 404 when I enter extensionID as 326:


curl --request GET \
  --url 'https://platform.ringcentral.com/restapi/v1.0/account/~/extension/326/phone-number?page=1&perPage=100'\


{
  "errorCode": "CMN-102",
  "message": "Resource for parameter [extensionId] is not found",
  "errors": [
    {
      "errorCode": "CMN-102",
      "message": "Resource for parameter [extensionId] is not found",
      "parameterName": "extensionId"
    }
  ],
  "parameterName": "extensionId"
}

I also want to make sure that I am not changing the company number for our entire account, just the direct number for the user using the extension.


EDIT: I found the issue, I needed to use the "id" not the extension number. I am able to add a phone line now!

The only other thing I have to figure out is if there is an API to make the phone number type fax only,


1700083373393.png


And also if there is an API that can make that primary number as the caller ID for fax number in user's profile

1700083475365.png

0 Likes 0 ·
1700083373393.png (16.2 KiB)
1700083475365.png (24.4 KiB)
Phong Vu avatar image Phong Vu ♦♦ Jackson Khan commented ·

That is the thing. Extension id (an identifier) is different than extension number (a label).

Don't specify the type when assign a phone number. For some reason, it causes a error Bad request. I will report this to get it fixed.

0 Likes 0 ·
Jackson Khan avatar image Jackson Khan Phong Vu ♦♦ commented ·

Great, thanks! But do you know if there is an API to do the other steps I wanted: make the phone number fax only and also make the primary number as the caller ID for fax number?

0 Likes 0 ·
Show more comments

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