如何通过REST API向已有RingCentral呼叫转接响铃组添加号码?
Got it, let's break down how to append a number to an existing ring group (the one you create in the portal by selecting multiple numbers and clicking "Create Ring Group") using the RingCentral REST API. Here's a step-by-step guide:
1. Identify Your Target Ring Group's ID
First, you need to find the unique ID of the ring group you want to modify. RingCentral refers to these groups as Forwarding Number Groups in the API.
Call this endpoint to get all your forwarding numbers/groups:
GET /restapi/v1.0/account/{accountId}/extension/{extensionId}/forwarding-number
Look for the entry where type is Group — that's your existing ring group. Save its id (we'll call this groupId for later).
2. Create a Forwarding Number for the New Contact (If Not Already Exists)
Before adding the number to the group, you need to register it as a forwarding number in your extension:
Send a POST request to create the new forwarding number:
POST /restapi/v1.0/account/{accountId}/extension/{extensionId}/forwarding-number
With this JSON body (replace with your details):
{ "phoneNumber": "+15551234567", "label": "New Team Member", "type": "Other" }
Save the id of this newly created forwarding number (let's call it newNumberId).
3. Update the Existing Ring Group to Include the New Number
Now, update the ring group to add the new number. Important: RingCentral's API uses full updates here, so you need to include all existing number IDs plus the new one (otherwise, you'll overwrite the group and lose existing entries).
Send a PUT request to update the group:
PUT /restapi/v1.0/account/{accountId}/extension/{extensionId}/forwarding-number/{groupId}
With this JSON body (replace placeholders with your actual IDs):
{ "name": "Your Existing Ring Group Name", "forwardingNumbers": [ "existing-number-id-1", "existing-number-id-2", "newNumberId" ] }
4. Verify the Ring Group is Attached to Your Answering Rule (If Needed)
If your ring group is already linked to an answering rule (like business hours forwarding), you don't need to do anything here. But if you want to confirm or adjust this, you can update the answering rule:
Call this endpoint to get your existing answering rules:
GET /restapi/v1.0/account/{accountId}/extension/{extensionId}/answering-rule
Find the rule you want (e.g., BusinessHours), then send a PUT request to ensure the ring group is included:
PUT /restapi/v1.0/account/{accountId}/extension/{extensionId}/answering-rule/{ruleId}
With this JSON body:
{ "forwarding": [ { "type": "Group", "forwardingNumberId": "groupId", "ringCount": 5 } ] }
Key Notes to Keep in Mind
- Permissions: Make sure your API app has the
EditExtensionsandEditAnsweringRulesscopes enabled. - E.164 Format: Always use E.164 formatted numbers (e.g.,
+15551234567) when creating forwarding numbers. - Full Update Requirement: When updating the ring group, never omit existing number IDs — the API replaces the entire
forwardingNumbersarray with what you send.
内容的提问来源于stack exchange,提问作者Grokify

