Update Phone Number Routes

Use this endpoint to update both the primary and failover routes for a phone number. You must create the routes first using the Create an Inbound Route endpoint. You can then assign the created routes by specifying their values within an array: the first route_name will be assigned as the primary route; the second route_name will be the failover route in the event the first route is unavailable.

Endpoint

PATCH /tns/telephone_number

Request Parameters

  • routes
    string REQUIRED

    The routes to be assigned to your phone number. Both the primary and failover routes must be specified inside of an array following this format:rtes = [Route(name=primary route), Route(name=secondary route)]. The first route name will be assigned as the primary route and the second route name specified will be assigned as the failover route. See List Inbound Routes for the steps to obtain available routes.

  • number
    string REQUIRED

    The phone number to which the route(s) will be assigned. This number must be in E.164 format. e.g. 12065551234

Example Request

This assumes that you have the Python API Wrapper installed and set up.

#Instantiate the Controller
tnc = TelephoneNumbersController()

'''
1. List Inbound Routes for your Flowroute numbers
2. Update Inbound Routes of a phone number based on your existing routes
'''
rtes = [Route(name='MyNewHostRoute'), Route(name='MyNewPSTNRoute')]
response = tnc.update(number=12065555780, routes=rtes)

                        

Example Request

This assumes that you have the PHP API Wrapper installed and set up.

#Instantiate the Controller
$tnc = new TelephoneNumbersController();

use FlowrouteNumbersLib\Models\BillingMethod;

/*
1. List Inbound Routes for your Flowroute numbers
2. Update Inbound Routes of a phone number based on your existing routes
*/
$rtes = '{"routes": [{"name": "HOSTroute1"}, {"name": "PSTNroute1"}]}';
$response = $tnc->update('12065555780',$rtes);

                        

Example Request

This assumes that you have the Ruby API Wrapper installed and set up.

#Instantiate the Controller
tnc = FlowrouteNumbers::TelephoneNumbersController.new()

=begin
1. List Inbound Routes for your Flowroute numbers
2. Update Inbound Routes of a phone number based on your existing routes
=end
rtes = [name: "MyNewHostRoute", name: "MyNewPSTNRoute"]
response = tnc.update(number='12065555780', routes=rtes)

                        

Example Request

This assumes that you have the Node.js API Wrapper installed and set up.

/*
1. Load the Numbers v1 SDK and Node.js util module
2. Declare flowroutenumberslib path relative to your JS file
*/
var flowroute = require('./flowroutenumberslib'); 
var util = require('util');

var cb =  function(err, response){
  if(err){
    console.log(err);
  }
  console.log(util.inspect(response, false, null));
};

/*
1. List Inbound Routes for your Flowroute numbers
2. Update Inbound Routes of a phone number based on your existing routes
*/
var rtes = '[{"name":"MyNewHOSTRoute"}, {"name":"MyNewPSTNRoute"}]';
flowroute.TelephoneNumbersController.update(12065555780, rtes, cb);

                        

Example Response

204 No Content

' '