Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

ConnectionPolicyTarget Resource


The ConnectionPolicyTarget resource describes the individual URI entries that make up the BYOC Origination ConnectionPolicies list.


ConnectionPolicyTarget Properties

connectionpolicytarget-properties page anchor
Resource properties
account_sidtype: SID<AC>Not PII

connection_policy_sidtype: SID<NY>Not PII

The SID of the Connection Policy that owns the Target.


sidtype: SID<NE>Not PII

The unique string that we created to identify the Target resource.


friendly_nametype: stringNot PII

The string that you assigned to describe the resource.


targettype: string<URI>PII MTL: 30 days

The SIP address you want Twilio to route your calls to. This must be a sip: schema. sips is NOT supported.


prioritytype: integerNot PII

The relative importance of the target. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important target.


weighttype: integerNot PII

The value that determines the relative share of the load the Target should receive compared to other Targets with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. Targets with higher values receive more load than those with lower ones with the same priority.


enabledtype: booleanNot PII

Whether the target is enabled. The default is true.


date_createdtype: string<DATE TIME>Not PII

The date and time in GMT when the resource was created specified in RFC 2822(link takes you to an external page) format.


date_updatedtype: string<DATE TIME>Not PII

The date and time in GMT when the resource was last updated specified in RFC 2822(link takes you to an external page) format.


urltype: string<URI>Not PII

The absolute URL of the resource.


Create a ConnectionPolicyTarget resource

create-a-connectionpolicytarget-resource page anchor
POST https://voice.twilio.com/v1/ConnectionPolicies/{ConnectionPolicySid}/Targets

Parameters

create-parameters page anchor
URI parameters
ConnectionPolicySidtype: SID<NY>Not PII
Path Parameter

The SID of the Connection Policy that owns the Target.


Request body parameters
Targettype: string<URI>PII MTL: 30 days
Required

The SIP address you want Twilio to route your calls to. This must be a sip: schema. sips is NOT supported.


FriendlyNametype: stringNot PII

A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long.


Prioritytype: integerNot PII

The relative importance of the target. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important target.


Weighttype: integerNot PII

The value that determines the relative share of the load the Target should receive compared to other Targets with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. Targets with higher values receive more load than those with lower ones with the same priority.


Enabledtype: booleanNot PII

Whether the Target is enabled. The default is true.

Create a ConnectionPolicyTarget

create-a-connectionpolicytarget page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
_11
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11
const authToken = process.env.TWILIO_AUTH_TOKEN;
_11
const client = require('twilio')(accountSid, authToken);
_11
_11
client.voice.v1.connectionPolicies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.targets
_11
.create({target: 'https://example.com'})
_11
.then(connection_policy_target => console.log(connection_policy_target.sid));

Output

_13
{
_13
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"connection_policy_sid": "NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"sid": "NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"friendly_name": "friendly_name",
_13
"target": "sip:sip-box.com:1234",
_13
"priority": 1,
_13
"weight": 20,
_13
"enabled": true,
_13
"date_created": "2020-03-18T23:31:36Z",
_13
"date_updated": "2020-03-18T23:31:36Z",
_13
"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Targets/NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_13
}


Fetch a ConnectionPolicyTarget resource

fetch-a-connectionpolicytarget-resource page anchor
GET https://voice.twilio.com/v1/ConnectionPolicies/{ConnectionPolicySid}/Targets/{Sid}

URI parameters
ConnectionPolicySidtype: SID<NY>Not PII
Path Parameter

The SID of the Connection Policy that owns the Target.


Sidtype: SID<NE>Not PII
Path Parameter

The unique string that we created to identify the Target resource to fetch.

Fetch a ConnectionPolicyTarget

fetch-a-connectionpolicytarget page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
_11
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11
const authToken = process.env.TWILIO_AUTH_TOKEN;
_11
const client = require('twilio')(accountSid, authToken);
_11
_11
client.voice.v1.connectionPolicies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.targets('NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.fetch()
_11
.then(connection_policy_target => console.log(connection_policy_target.friendlyName));

Output

_13
{
_13
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"connection_policy_sid": "NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"sid": "NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"friendly_name": "friendly_name",
_13
"target": "sip:sip-box.com:1234",
_13
"priority": 1,
_13
"weight": 20,
_13
"enabled": true,
_13
"date_created": "2020-03-18T23:31:36Z",
_13
"date_updated": "2020-03-18T23:31:37Z",
_13
"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Targets/NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_13
}


Read multiple ConnectionPolicyTarget resources

read-multiple-connectionpolicytarget-resources page anchor
GET https://voice.twilio.com/v1/ConnectionPolicies/{ConnectionPolicySid}/Targets

URI parameters
ConnectionPolicySidtype: SID<NY>Not PII
Path Parameter

The SID of the Connection Policy from which to read the Targets.


PageSizetype: integerNot PII
Query Parameter

How many resources to return in each list page. The default is 50, and the maximum is 1000.


Pagetype: integerNot PII
Query Parameter

The page index. This value is simply for client state.


PageTokentype: stringNot PII
Query Parameter

The page token. This is provided by the API.

List multiple ConnectionPolicyTargets

list-multiple-connectionpolicytargets page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
_11
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11
const authToken = process.env.TWILIO_AUTH_TOKEN;
_11
const client = require('twilio')(accountSid, authToken);
_11
_11
client.voice.v1.connectionPolicies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.targets
_11
.list({limit: 20})
_11
.then(targets => targets.forEach(t => console.log(t.sid)));

Output

_26
{
_26
"meta": {
_26
"page": 0,
_26
"page_size": 50,
_26
"first_page_url": "https://voice.twilio.com/v1/ConnectionPolicies/NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Targets?PageSize=50&Page=0",
_26
"previous_page_url": "https://voice.twilio.com/v1/ConnectionPolicies/NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Targets?PageSize=50&Page=0",
_26
"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Targets?PageSize=50&Page=0",
_26
"next_page_url": "https://voice.twilio.com/v1/ConnectionPolicies/NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Targets?PageSize=50&Page=1",
_26
"key": "targets"
_26
},
_26
"targets": [
_26
{
_26
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_26
"connection_policy_sid": "NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_26
"sid": "NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_26
"friendly_name": "friendly_name",
_26
"target": "sip:sip-box.com:1234",
_26
"priority": 1,
_26
"weight": 20,
_26
"enabled": true,
_26
"date_created": "2020-03-18T23:31:36Z",
_26
"date_updated": "2020-03-18T23:31:37Z",
_26
"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Targets/NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_26
}
_26
]
_26
}


Update a ConnectionPolicyTarget resource

update-a-connectionpolicytarget-resource page anchor
POST https://voice.twilio.com/v1/ConnectionPolicies/{ConnectionPolicySid}/Targets/{Sid}

URI parameters
ConnectionPolicySidtype: SID<NY>Not PII
Path Parameter

The SID of the Connection Policy that owns the Target.


Sidtype: SID<NE>Not PII
Path Parameter

The unique string that we created to identify the Target resource to update.


Request body parameters
FriendlyNametype: stringNot PII

A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long.


Targettype: string<URI>PII MTL: 30 days

The SIP address you want Twilio to route your calls to. This must be a sip: schema. sips is NOT supported.


Prioritytype: integerNot PII

The relative importance of the target. Can be an integer from 0 to 65535, inclusive. The lowest number represents the most important target.


Weighttype: integerNot PII

The value that determines the relative share of the load the Target should receive compared to other Targets with the same priority. Can be an integer from 1 to 65535, inclusive. Targets with higher values receive more load than those with lower ones with the same priority.


Enabledtype: booleanNot PII

Whether the Target is enabled.

Update a ConnectionPolicyTarget

update-a-connectionpolicytarget page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
_11
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11
const authToken = process.env.TWILIO_AUTH_TOKEN;
_11
const client = require('twilio')(accountSid, authToken);
_11
_11
client.voice.v1.connectionPolicies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.targets('NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.update({friendlyName: 'friendly_name'})
_11
.then(connection_policy_target => console.log(connection_policy_target.friendlyName));

Output

_13
{
_13
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"connection_policy_sid": "NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"sid": "NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"friendly_name": "updated_name",
_13
"target": "sip:sip-updated.com:4321",
_13
"priority": 2,
_13
"weight": 10,
_13
"enabled": false,
_13
"date_created": "2020-03-18T23:31:36Z",
_13
"date_updated": "2020-03-18T23:31:37Z",
_13
"url": "https://voice.twilio.com/v1/ConnectionPolicies/NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Targets/NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_13
}


Delete a ConnectionPolicyTarget resource

delete-a-connectionpolicytarget-resource page anchor
DELETE https://voice.twilio.com/v1/ConnectionPolicies/{ConnectionPolicySid}/Targets/{Sid}

URI parameters
ConnectionPolicySidtype: SID<NY>Not PII
Path Parameter

The SID of the Connection Policy that owns the Target.


Sidtype: SID<NE>Not PII
Path Parameter

The unique string that we created to identify the Target resource to delete.

Delete a ConnectionPolicyTarget

delete-a-connectionpolicytarget page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.voice.v1.connectionPolicies('NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.targets('NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.remove();


Rate this page: