REST API: 着信電話番号

IncomingPhoneNumber インスタン スリソースは、Twilio から購入した電話番号、または Twilio へポーティングした Twilio 電話番号を表現します。

IncomingPhoneNumber リスト リソースは、アカウントの Twilio 電話番号を表現します。 新しい Twilio 番号をプロビジョニングするには、このリスト リソースに POST します。 プロビジョニングする新しい番号を検索するには、 AvailablePhoneNumber リソースのサブリソースを使用します。

サブアカウントを使用している場合は、2 つの Twilio アカウントの間で電話番号を移動することができます。 詳細は、 サブアカウント間で番号を交換するを参照してください。

電話番号のプロビジョニングには、2 つのステップがあります。 まず、 AvailablePhoneNumber リソースのサブリソースを使って、プロビジョニングを行う使用可能な番号を検索します。 次に、必ず IncomingPhoneNumbers リスト リソースに POSTします。 次のセクションで詳細を説明します。

IncomingPhoneNumber インスタンス リソース

リソース URI

/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{IncomingPhoneNumberSid}

リソースのプロパティ

プロパティ 説明
Sid このリソースを一意に識別する 34 文字の文字列です。
DateCreated このリソースが生成された日付の GMT 表記です。 RFC 2822 フォーマットを使用します。
DateUpdated このリソースが最後に更新された日付の GMT 表記です。RFC 2822フォーマットを使用します。
FriendlyName このリソースの、人間が読みやすい形式の説明です。64 文字まで設定できます。 デフォルトでは、FriendlyName はこの電話番号のわかりやすい表記になります。
AccountSid この電話番号用アカウントの一意なID
PhoneNumber 着信電話番号です。例 : +16175551212 (E.164 フォーマット)
ApiVersion この電話番号への着信があると、この API バージョンを使って新しい TwiML セッションを開始します。
VoiceCallerIdLookup 発信者の発信者 ID 名を、CNAM データベースから検索します (検索 1 件あたり 1.5円)。 true または false のいずれかです。
VoiceUrl この番号への通話を受けた時に、Twilio がリクエストを送信する URL です。VoiceURLは VoiceApplicationSidもしくはTrunkSidが設定されているときは使われません。
VoiceMethod 上述の Url へリクエストを送信する際に、Twilio が使用する HTTP のメソッドです。GET または POST のいずれかです。
VoiceFallbackUrl VoiceUrl でリクエストされた TwiML の取得または実行時にエラーが発生した場合、Twilio がリクエストを送信する Url です。
VoiceFallbackMethod VoiceFallbackUrl へリクエストを送信する際に、Twilio が使用する HTTP のメソッドです。GET または POST のいずれかです。
StatusCallback ステータス パラメーター (通話の終了など) をアプリケーションへ渡すために、Twilio がリクエストを送信する URL です。
StatusCallbackMethod StatusCallback URL へリクエストを送信する際に、Twilio が使用する HTTP のメソッドです。GET または POST のいずれかです。
VoiceApplicationSid 34文字のTwilioアプリケーションSIDがこの番号へ電話がかかってきた時に使われます。VoiceApplicationSidが存在する場合、Twilioは上記のVoiceURLを無視し、これらの値をアプリケーションにセットします。VoiceApplicationSidを設定するとTrunkSidが自動的に削除されます。
TrunkSid トランクを示す34文字のSID,Twilioはこの番号に着信した時に通話をハンドリングします。TrunkSidが存在する場合、Twilioは上記のVoiceURLと Voiceアプリケーションを無視し、これらをトランクにセットします。TrunkSidが設定された場合、VoiceApplicationSidは自動的に削除されます。
SmsUrl この番号への着信 SMS メッセージを受信した時に、Twilio がリクエストを送信する URL です。
SmsMethod SmsUrl へリクエストを送信する際に、Twilio が使用する HTTP のメソッドです。GET または POST のいずれかです。
SmsFallbackUrl SmsUrl から TwiML の取得または実行時にエラーが発生した場合、Twilio がリクエストを送信する URL です。
SmsFallbackMethod 上述の URL へリクエストを送信する際に、Twilio が使用する HTTP のメソッドです。GET または POST のいずれかです。
SmsApplicationSid この番号宛の SMS を処理するために Twilio が使用するアプリケーションの、34 文字の sid です。 SmsApplicationSid が設定さている場合、Twilio は上述のすべての URL を無視して、アプリケーションの設定を使用します。
利用可能な機能 電話番号が電話、メッセージを受信できるかどうかを示します有力な候補はVoiceSMSMMSで、それらはtrueもしくはfalseの値を持ちます。
AddressRequirements 意味することは、電話番号があなた、もしくはあなたのお客様が住所をTwilioに登録する必要かあるかどうかを示します。取りうる値はnoneanylocalもしくはforeignです。
ベータ ベータステータスの電話番号フラグ取りうる値は true もしくは false
Uri このリソースの URI です。https://api.twilio.com からの相対パスです。

アドレス要件値

下記は address_required プロパティ として取りうる値です。

Status 説明
なし このアドレスは電話番号に必要ではありません。
any このアカウントは住所を必要としています。しかし、世界中のどこでもご利用いただけます。
ローカル このアカウントは電話番号の国の住所が必要です。
foreign あなたのアカウントは電話番号の国ではない住所が必要です。

HTTP GET

IncomingPhoneNumber の取得
  • C#
  • curl
  • Java
  • Node.js
  • PHP
  • Python
  • Ruby
SDKバージョン:
  • 4.x
  • 5.x
レスポンス形式:
  • JSON
  • xml
SDKバージョン:
  • 6.x
  • 7.x
SDKバージョン:
  • 2.x
  • 3.x
SDKバージョン:
  • 4.x
  • 5.x
SDKバージョン:
  • 5.x
  • 6.x
SDKバージョン:
  • 4.x
  • 5.x
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account;

class Example
{
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";
        TwilioClient.Init(accountSid, authToken);

        var number = IncomingPhoneNumberResource.Fetch("PN2a0747eba6abf96b7e3c3ff0b4530f6e");

        Console.WriteLine(number.PhoneNumber);
    }
}
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$number = $client
    ->incomingPhoneNumbers("PN2a0747eba6abf96b7e3c3ff0b4530f6e")
    ->fetch();

echo $number->phoneNumber;
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

number = client.phone_numbers.get("PN2a0747eba6abf96b7e3c3ff0b4530f6e")
print(number.phone_number)
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

# Initialize Twilio Client
@client = Twilio::REST::Client.new(account_sid, auth_token)

@number = @client.account.incoming_phone_numbers('PN2a0747eba6abf96b7e3c3ff0b4530f6e')
                 .fetch

puts @number.phone_number
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PN2a0747eba6abf96b7e3c3ff0b4530f6e.json \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PN2a0747eba6abf96b7e3c3ff0b4530f6e \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.IncomingPhoneNumber;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Get an object from its sid. If you do not have a sid,
    // check out the list resource examples on this page
    IncomingPhoneNumber number = client.getAccount().getIncomingPhoneNumber("PN2a0747eba6abf96b7e3c3ff0b4530f6e");
    System.out.println(number.getPhoneNumber());
    
  }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

number = client.incoming_phone_numbers("PN2a0747eba6abf96b7e3c3ff0b4530f6e") \
               .fetch()

print(number.phone_number)
// Download the Node helper library from twilio.com/docs/node/install
// These identifiers are your accountSid and authToken from
// https://www.twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);

client.incomingPhoneNumbers('PN2a0747eba6abf96b7e3c3ff0b4530f6e')
  .fetch()
  .then((number) => console.log(number.phoneNumber));
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example 
{
  static void Main(string[] args) 
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    var number = twilio.GetIncomingPhoneNumber("PN2a0747eba6abf96b7e3c3ff0b4530f6e");
    
    Console.WriteLine(number.PhoneNumber);
  }
}
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$number = $client->account->incoming_phone_numbers->get("PN2a0747eba6abf96b7e3c3ff0b4530f6e");
echo $number->phone_number;
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token

# Get an object from its sid. If you do not have a sid,
# check out the list resource examples on this page
@number = @client.account.incoming_phone_numbers.get("PN2a0747eba6abf96b7e3c3ff0b4530f6e")
puts @number.phone_number
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.IncomingPhoneNumber;

public class Example {
  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    // Get an object from its sid. If you do not have a sid,
    // check out the list resource examples on this page
    IncomingPhoneNumber number =
        IncomingPhoneNumber.fetcher("PN2a0747eba6abf96b7e3c3ff0b4530f6e").fetch();

    System.out.println(number.getPhoneNumber());
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.incomingPhoneNumbers("PN2a0747eba6abf96b7e3c3ff0b4530f6e").get(function(err, number) {
    console.log(number.phoneNumber);
});
出力を表示
  • JSON
  • XML
{
  "sid": "PN2a0747eba6abf96b7e3c3ff0b4530f6e",
  "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "friendly_name": "My Company Line",
  "phone_number": "+15105647903",
  "voice_url": "http://demo.twilio.com/docs/voice.xml",
  "voice_method": "POST",
  "voice_fallback_url": null,
  "voice_fallback_method": "POST",
  "status_callback": null,
  "status_callback_method": null,
  "voice_caller_id_lookup": null,
  "voice_application_sid": null,
  "date_created": "Mon, 16 Aug 2010 23:00:23 +0000",
  "date_updated": "Mon, 16 Aug 2010 23:00:23 +0000",
  "sms_url": null,
  "sms_method": "POST",
  "sms_fallback_url": null,
  "sms_fallback_method": "GET",
  "sms_application_sid": "AP9b2e38d8c592488c397fc871a82a74ec",
  "capabilities": {
    "voice": true,
    "sms": true,
    "mms": false
  },
  "beta": false
  "api_version": "2010-04-01",
  "uri": "\/2010-04-01\/Accounts\/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\/IncomingPhoneNumbers\/PN2a0747eba6abf96b7e3c3ff0b4530f6e.json"
}
<TwilioResponse>
  <IncomingPhoneNumber>
    <Sid>PN2a0747eba6abf96b7e3c3ff0b4530f6e</Sid>
    <AccountSid>ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</AccountSid>
    <FriendlyName>My Company Line</FriendlyName>
    <PhoneNumber>+15105647903</PhoneNumber>
    <VoiceUrl>http://demo.twilio.com/docs/voice.xml</VoiceUrl>
    <VoiceMethod>POST</VoiceMethod>
    <VoiceFallbackUrl/>
    <VoiceFallbackMethod>POST</VoiceFallbackMethod>
    <StatusCallback/>
    <StatusCallbackMethod/>
    <VoiceCallerIdLookup>false</VoiceCallerIdLookup>
    <VoiceApplicationSid/>
    <DateCreated>Mon, 16 Aug 2010 23:00:23 +0000</DateCreated>
    <DateUpdated>Mon, 16 Aug 2010 23:00:23 +0000</DateUpdated>
    <SmsUrl/>
    <SmsMethod>POST</SmsMethod>
    <SmsFallbackUrl/>
    <SmsFallbackMethod>GET</SmsFallbackMethod>
    <SmsApplicationSid>AP9b2e38d8c592488c397fc871a82a74ec</SmsApplicationSid>
    <Capabilities>
      <Voice>true</Voice>
      <SMS>true</SMS>
      <MMS>false</MMS>
    </Capabilities>
    <Beta>false</Beta>
    <ApiVersion>2010-04-01</ApiVersion>
    <Uri>/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PN2a0747eba6abf96b7e3c3ff0b4530f6e</Uri>
  </IncomingPhoneNumber>
</TwilioResponse>
IncomingPhoneNumber の取得

HTTP POST と PUT

着信電話番号のプロパティを更新します。更新に成功すると、更新されたリソース表現を返します。 返却されるレスポンスは、GET リクエストを送信した場合と同じです。

オプションパラメーター

次のパラメーターの 1 つまたは複数を指定して、この電話番号のプロパティを更新できます。

パラメーター 説明
FriendlyName 新しい着信電話番号リソースの、人間が読みやすい形式の説明です。64 文字まで設定できます。
ApiVersion この電話番号への着信があると、この API バージョンを使って新しい TwiML セッションを開始します。 2010-04-01 または 2008-08-01のいずれかです。
VoiceUrl この番号がダイヤルされた時に、Twilio がリクエストを送信する URL。VoiceURLは VoiceApplicationSidもしくはTrunkSidが設定されているときは使われません。
VoiceMethod VoiceUrl へリクエストを送信する際に、Twilio が使用する HTTP のメソッドです。GET または POST のいずれかです。
VoiceFallbackUrl 上述の VoiceUrl で指定された TwiML のリクエストまたは実行時にエラーが発生した場合、Twilio がリクエストを送信する URL です。
VoiceFallbackMethod VoiceFallbackUrl へリクエストを送信する際に、Twilio が使用する HTTP のメソッドです。GET または POST のいずれかです。
StatusCallback ステータス パラメーター (通話の終了など) をアプリケーションへ渡すために、Twilio がリクエストを送信する URL です。
StatusCallbackMethod StatusCallback URL へリクエストを送信する際に、Twilio が使用する HTTP のメソッドです。GET または POST のいずれかです。
VoiceCallerIdLookup 発信者の名前を CNAM データベースから検索し、アプリケーションへ通知します。true または false のいずれかです。
VoiceApplicationSid 34文字のTwilioアプリケーションSIDがこの番号へ電話がかかってきた時に使われます。VoiceApplicationSidが存在する場合、Twilioは上記のVoiceURLを無視し、代わりにこれらの値をアプリケーションにセットします。VoiceApplicationSidが設定された場合、TrunkSidは自動的に削除されます。
TrunkSid トランクを示す34文字のSID,Twilioはこの番号に着信した時に通話をハンドリングします。TrunkSidが存在する場合、Twilioは上記のVoiceURLと Voiceアプリケーションを無視し、これらをトランクにセットします。TrunkSidが設定された場合、VoiceApplicationSidは自動的に削除されます。
SmsUrl 新しい電話番号宛てに SMS が送信された時に、Twilio がリクエストを送信する URL です。
SmsMethod SmsUrl へリクエストを送信する際に、Twilio が使用する HTTP のメソッドです。GET または POST のいずれかです。
SmsFallbackUrl 上述の SmsUrl で指定された TwiML のリクエストまたは実行時にエラーが発生した場合、Twilio がリクエストを送信する URL です。
SmsFallbackMethod SmsFallbackUrl へリクエストを送信する際に、Twilio が使用する HTTP のメソッドです。GET または POST のいずれかです。
SmsApplicationSid この番号宛の SMS を処理するために Twilio が使用するアプリケーションの、34 文字の sid です。 SmsApplicationSid が設定さている場合、Twilio は上述のすべての URL を無視して、アプリケーションの設定を使用します。
AccountSid この電話番号を移動したいアカウントの、34 文字のユニークな ID です。 サブアカウント間で番号を交換するを参照してください。
例 1

VoiceUrlとSmsUrlを電話場号に割り当てます

IncomingPhoneNumber の更新
  • C#
  • curl
  • Java
  • Node.js
  • PHP
  • Python
  • Ruby
SDKバージョン:
  • 4.x
  • 5.x
レスポンス形式:
  • JSON
  • xml
SDKバージョン:
  • 6.x
  • 7.x
SDKバージョン:
  • 2.x
  • 3.x
SDKバージョン:
  • 4.x
  • 5.x
SDKバージョン:
  • 5.x
  • 6.x
SDKバージョン:
  • 4.x
  • 5.x
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account;

class Example
{
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";
        TwilioClient.Init(accountSid, authToken);

        IncomingPhoneNumberResource.Update(
            "PN2a0747eba6abf96b7e3c3ff0b4530f6e",
            voiceUrl: new Uri("http://demo.twilio.com/docs/voice.xml"),
            smsUrl: new Uri("http://demo.twilio.com/docs/sms.xml"));
    }
}
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$number = $client
    ->incomingPhoneNumbers("PN2a0747eba6abf96b7e3c3ff0b4530f6e")
    ->update(
        array(
            "voiceUrl" => "http://demo.twilio.com/docs/voice.xml",
            "smsUrl" => "http://demo.twilio.com/docs/sms.xml"
        )
    );

echo $number->voiceUrl;
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

number = client.phone_numbers.update("PN2a0747eba6abf96b7e3c3ff0b4530f6e", voice_url="http://demo.twilio.com/docs/voice.xml",
    sms_url="http://demo.twilio.com/docs/sms.xml")
print(number.voice_url)
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'twilio-ruby'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

# Initialize Twilio Client
@client = Twilio::REST::Client.new(account_sid, auth_token)

@number = @client.account
                 .incoming_phone_numbers('PN2a0747eba6abf96b7e3c3ff0b4530f6e')
                 .fetch

@number.update(
  voice_url: 'http://demo.twilio.com/docs/voice.xml',
  sms_url: 'http://demo.twilio.com/docs/sms.xml'
)

puts @number.voice_url
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PN2a0747eba6abf96b7e3c3ff0b4530f6e.json \
    -d "VoiceUrl=http://demo.twilio.com/docs/voice.xml" \
    -d "SmsUrl=http://demo.twilio.com/docs/sms.xml" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PN2a0747eba6abf96b7e3c3ff0b4530f6e \
    -d "VoiceUrl=http://demo.twilio.com/docs/voice.xml" \
    -d "SmsUrl=http://demo.twilio.com/docs/sms.xml" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.IncomingPhoneNumber;
import com.twilio.sdk.resource.list.IncomingPhoneNumberList;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Get an object from its sid. If you do not have a sid,
    // check out the list resource examples on this page
    IncomingPhoneNumber number = client.getAccount().getIncomingPhoneNumber("PN2a0747eba6abf96b7e3c3ff0b4530f6e");
    // Build a filter for the IncomingPhoneNumberList
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    params.add(new BasicNameValuePair("VoiceUrl", "http://demo.twilio.com/docs/voice.xml"));
    params.add(new BasicNameValuePair("SmsUrl", "http://demo.twilio.com/docs/sms.xml"));
    number.update(params); 
  }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

number = client.incoming_phone_numbers("PN2a0747eba6abf96b7e3c3ff0b4530f6e") \
               .update(voice_url="http://demo.twilio.com/docs/voice.xml",
                       sms_url="http://demo.twilio.com/docs/sms.xml")

print(number.voice_url)
// Download the Node helper library from twilio.com/docs/node/install
// These identifiers are your accountSid and authToken from
// https://www.twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);

client.incomingPhoneNumbers('PN2a0747eba6abf96b7e3c3ff0b4530f6e')
  .update({
    voiceUrl: 'http://demo.twilio.com/docs/voice.xml',
    smsUrl: 'http://demo.twilio.com/docs/sms.xml',
  })
  .then((number) => console.log(number.voiceUrl));
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example 
{
  static void Main(string[] args) 
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    var options = new PhoneNumberOptions();
    options.VoiceUrl = "http://demo.twilio.com/docs/voice.xml";
    options.SmsUrl = "http://demo.twilio.com/docs/sms.xml";
    
    twilio.UpdateIncomingPhoneNumber("PN2a0747eba6abf96b7e3c3ff0b4530f6e", options);
  }
}
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$number = $client->account->incoming_phone_numbers->get("PN2a0747eba6abf96b7e3c3ff0b4530f6e");
$number->update(array(
        "VoiceUrl" => "http://demo.twilio.com/docs/voice.xml",
    "SmsUrl" => "http://demo.twilio.com/docs/sms.xml"
    ));
echo $number->voice_url;
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token

# Get an object from its sid. If you do not have a sid,
# check out the list resource examples on this page
@number = @client.account.incoming_phone_numbers.get("PN2a0747eba6abf96b7e3c3ff0b4530f6e")
@number.update(:voice_url => "http://demo.twilio.com/docs/voice.xml",
               :sms_url => "http://demo.twilio.com/docs/sms.xml")
puts @number.voice_url
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.IncomingPhoneNumber;

public class Example {
  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    // Get an object from its sid. If you do not have a sid,
    // check out the list resource examples on this page
    IncomingPhoneNumber number = IncomingPhoneNumber.updater("PN2a0747eba6abf96b7e3c3ff0b4530f6e")
        .setVoiceUrl("http://demo.twilio.com/docs/voice.xml")
        .setSmsUrl("http://demo.twilio.com/docs/sms.xml").update();

    System.out.println(number.getDateUpdated());
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.incomingPhoneNumbers("PN2a0747eba6abf96b7e3c3ff0b4530f6e").update({
    voiceUrl: "http://demo.twilio.com/docs/voice.xml",
    smsUrl: "http://demo.twilio.com/docs/sms.xml"
}, function(err, number) {
    console.log(number.voiceUrl);
});
出力を表示
  • JSON
  • XML
{
  "sid": "PN2a0747eba6abf96b7e3c3ff0b4530f6e",
  "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "friendly_name": "My Company Line",
  "phone_number": "+15105647903",
  "voice_url": "http://demo.twilio.com/docs/voice.xml",
  "voice_method": "POST",
  "voice_fallback_url": null,
  "voice_fallback_method": "POST",
  "voice_caller_id_lookup": null,
  "voice_application_sid": null,
  "date_created": "Mon, 16 Aug 2010 23:00:23 +0000",
  "date_updated": "Mon, 16 Aug 2010 23:00:23 +0000",
  "sms_url": "http://demo.twilio.com/docs/sms.xml",
  "sms_method": "POST",
  "sms_fallback_url": null,
  "sms_fallback_method": "GET",
  "sms_application_sid": null,
  "capabilities": {
    "voice": true,
    "sms": true,
    "mms": false
  },
  "beta": false
  "status_callback": null,
  "status_callback_method": null,
  "api_version": "2010-04-01",
  "uri": "\/2010-04-01\/Accounts\/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\/IncomingPhoneNumbers\/PN2a0747eba6abf96b7e3c3ff0b4530f6e.json"
}
<TwilioResponse>
  <IncomingPhoneNumber>
    <Sid>PN2a0747eba6abf96b7e3c3ff0b4530f6e</Sid>
    <AccountSid>ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</AccountSid>
    <FriendlyName>My Company Line</FriendlyName>
    <PhoneNumber>+15105647903</PhoneNumber>
    <VoiceUrl>http://demo.twilio.com/docs/voice.xml</VoiceUrl>
    <VoiceMethod>POST</VoiceMethod>
    <VoiceFallbackUrl/>
    <VoiceFallbackMethod>POST</VoiceFallbackMethod>
    <VoiceCallerIdLookup>false</VoiceCallerIdLookup>
    <VoiceApplicationSid/>
    <DateCreated>Mon, 16 Aug 2010 23:00:23 +0000</DateCreated>
    <DateUpdated>Mon, 16 Aug 2010 23:00:23 +0000</DateUpdated>
    <SmsUrl>http://demo.twilio.com/docs/sms.xml</SmsUrl>
    <SmsMethod>POST</SmsMethod>
    <SmsFallbackUrl/>
    <SmsFallbackMethod>GET</SmsFallbackMethod>
    <SmsApplicationSid/>
    <Capabilities>
      <Voice>true</Voice>
      <SMS>true</SMS>
      <MMS>false</MMS>
    </Capabilities>
    <Beta>false</Beta>
    <StatusCallback/>
    <StatusCallbackMethod/>
    <ApiVersion>2010-04-01</ApiVersion>
    <Uri>/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PN2a0747eba6abf96b7e3c3ff0b4530f6e</Uri>
  </IncomingPhoneNumber>
</TwilioResponse>
IncomingPhoneNumber の更新

HTTP DELETE

この電話番号をアカウントから開放します。 Twilio は今後、この電話番号への通話に応答しません。毎月の電話番号使用料の課金は停止されます。電話番号は再利用されます。将来他のユーザーに付与される可能性がありますので、注意してください。 誤って開放してしまった場合は、Twilio へお問い合わせください。 番号を復元できる場合があります。

開放に成功すると、ボディーのない HTTP 204 レスポンスを返します。

IncomingPhoneNumbers リスト リソース

リソース URI

/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers

HTTP GET

IncomingPhoneNumber リソース表現のリストを返します。各項目は、アカウントに割り当てられた電話番号を表現します。 このリストは ページ情報を含みます。

リスト フィルター

次のクエリ パラメーターを使って、返却されるリストに制限を加えます。 パラメーターの大文字と小文字は区別されます。

パラメーター 説明
PhoneNumber このパターンに一致する着信電話番号リソースのみを返します。 番号の一部を指定し、「*」を任意の 1 桁のワイルドカードとして使用することができます。
FriendlyName この名前と FriendlyName が一致する着信電話番号 リソースのみを返します。
ベータ 提供されたばかりのベータの電話番号を含める取りうる値は true もしくは false。デフォルトは true.
例 1
SDKバージョン:
  • 4.x
  • 5.x
レスポンス形式:
  • JSON
  • xml
SDKバージョン:
  • 6.x
  • 7.x
SDKバージョン:
  • 2.x
  • 3.x
SDKバージョン:
  • 4.x
  • 5.x
SDKバージョン:
  • 5.x
  • 6.x
SDKバージョン:
  • 4.x
  • 5.x
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account;

class Example
{
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";
        TwilioClient.Init(accountSid, authToken);

        var numbers = IncomingPhoneNumberResource.Read();

        foreach (var number in numbers)
        {
            Console.WriteLine(number.PhoneNumber);
        }
    }
}
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

// Loop over the list of numbers and echo a property for each one
foreach ($client->incomingPhoneNumbers->read() as $number) {
    echo $number->phoneNumber;
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

# A list of number objects with the properties described above
numbers = client.phone_numbers.list()
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'twilio-ruby'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

# Initialize Twilio Client
@client = Twilio::REST::Client.new(account_sid, auth_token)

@client.account.incoming_phone_numbers.list.each do |number|
  puts number.phone_number
end
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.json \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.IncomingPhoneNumber;
import com.twilio.sdk.resource.list.IncomingPhoneNumberList;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);
    
    IncomingPhoneNumberList numbers = client.getAccount().getIncomingPhoneNumbers();
    
    // Loop over numbers and print out a property for each one.
    for (IncomingPhoneNumber number : numbers) {
      System.out.println(number.getPhoneNumber());
    } 
  }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

# A list of number objects with the properties described above
for number in client.incoming_phone_numbers.list():
    print(number.phone_number)
// Download the Node helper library from twilio.com/docs/node/install
// These identifiers are your accountSid and authToken from
// https://www.twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);

client.incomingPhoneNumbers.each((number) => console.log(number.phoneNumber));
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example 
{
  static void Main(string[] args) 
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    var numbers = twilio.ListIncomingPhoneNumbers(null, null, null, null);
    
    foreach (var number in numbers.IncomingPhoneNumbers)
    {
      Console.WriteLine(number.PhoneNumber);
    }
  }
}
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

// Loop over the list of numbers and echo a property for each one
foreach ($client->account->incoming_phone_numbers as $number) {
    echo $number->phone_number;
}
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token


# Loop over numbers and print out a property for each one
@client.account.incoming_phone_numbers.list.each do |number|
  puts number.phone_number
end
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.base.ResourceSet;
import com.twilio.rest.api.v2010.account.IncomingPhoneNumber;

public class Example {
  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    ResourceSet<IncomingPhoneNumber> numbers = IncomingPhoneNumber.reader().read();

    // Loop over numbers and print out a property for each one.
    for (IncomingPhoneNumber number : numbers) {
      System.out.println(number.getPhoneNumber());
    }
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.incomingPhoneNumbers.list(function(err, data) {
    data.incomingPhoneNumbers.forEach(function(number) {
        console.log(number.phoneNumber);
    });
});
出力を表示
  • JSON
  • XML
{
  "page": 0,
  "page_size": 50,
  "uri": "\/2010-04-01\/Accounts\/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\/IncomingPhoneNumbers.json",
  "first_page_uri": "\/2010-04-01\/Accounts\/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\/IncomingPhoneNumbers.json?Page=0&PageSize=50",
  "previous_page_uri": null,
  "next_page_uri": null,
  "incoming_phone_numbers": [
    {
      "sid": "PN3f94c94562ac88dccf16f8859a1a8b25",
      "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
      "friendly_name": "Long Play",
      "phone_number": "+14152374451",
      "voice_url": "http:\/\/demo.twilio.com\/docs/voice.xml",
      "voice_method": "GET",
      "voice_fallback_url": null,
      "voice_fallback_method": null,
      "voice_caller_id_lookup": null,
      "voice_application_sid": null,
      "date_created": "Thu, 13 Nov 2008 07:56:24 +0000",
      "date_updated": "Thu, 13 Nov 2008 08:45:58 +0000",
      "sms_url": null,
      "sms_method": null,
      "sms_fallback_url": null,
      "sms_fallback_method": null,
      "sms_application_sid": AP9b2e38d8c592488c397fc871a82a74ec,
      "capabilities": {
        "voice": true,
        "sms": false,
        "mms": false
      },
      "beta": false
      "status_callback": null,
      "status_callback_method": null,
      "api_version": "2010-04-01",
      "uri": "\/2010-04-01\/Accounts\/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\/IncomingPhoneNumbers\/PN3f94c94562ac88dccf16f8859a1a8b25.json"
    },
    ...
  ]
}
<TwilioResponse>
  <IncomingPhoneNumbers page="0" pagesize="50" uri="/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers" firstpageuri="/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers?Page=0&PageSize=50" previouspageuri="" nextpageuri="">
    <IncomingPhoneNumber>
      <Sid>PN3f94c94562ac88dccf16f8859a1a8b25</Sid>
      <AccountSid>ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</AccountSid>
      <FriendlyName>Long Play</FriendlyName>
      <PhoneNumber>+14152374451</PhoneNumber>
      <VoiceUrl>http://demo.twilio.com/docs/voice.xml</VoiceUrl>
      <VoiceMethod>GET</VoiceMethod>
      <VoiceFallbackUrl/>
      <VoiceFallbackMethod/>
      <VoiceCallerIdLookup>false</VoiceCallerIdLookup>
      <VoiceApplicationSid/>
      <DateCreated>Thu, 13 Nov 2008 07:56:24 +0000</DateCreated>
      <DateUpdated>Thu, 13 Nov 2008 08:45:58 +0000</DateUpdated>
      <SmsUrl/>
      <SmsMethod/>
      <SmsFallbackUrl/>
      <SmsFallbackMethod/>
      <SmsApplicationSid>AP9b2e38d8c592488c397fc871a82a74ec</SmsApplicationSid>
      <Capabilities>
        <Voice>true</Voice>
        <SMS>false</SMS>
        <MMS>false</MMS>
      </Capabilities>
      <Beta>false</Beta>
      <StatusCallback/>
      <StatusCallbackMethod/>
      <ApiVersion>2010-04-01</ApiVersion>
      <Uri>/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PN3f94c94562ac88dccf16f8859a1a8b25</Uri>
    </IncomingPhoneNumber>
    ...
  </IncomingPhoneNumbers>
</TwilioResponse>
アカウントのすべての IncomingPhoneNumber のリストの取得
例 2

(415) 867-5309 に完全に一致する電話番号のセットを返します。

SDKバージョン:
  • 4.x
  • 5.x
レスポンス形式:
  • JSON
  • xml
SDKバージョン:
  • 6.x
  • 7.x
SDKバージョン:
  • 2.x
  • 3.x
SDKバージョン:
  • 4.x
  • 5.x
SDKバージョン:
  • 5.x
  • 6.x
SDKバージョン:
  • 4.x
  • 5.x
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account;
using Twilio.Types;

class Example
{
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";
        TwilioClient.Init(accountSid, authToken);

        var numbers = IncomingPhoneNumberResource.Read(
            phoneNumber: new PhoneNumber("+14158675309"));

        foreach (var number in numbers)
        {
            Console.WriteLine(number.PhoneNumber);
        }
    }
}
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

$numbers = $client->incomingPhoneNumbers->read(
    array("phoneNumber" => "+14158675309")
);
// Loop over the list of numbers and echo a property for each one
foreach ($numbers as $number) {
    echo $number->phoneNumber;
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

# A list of number objects with the properties described above
numbers = client.phone_numbers.list(phone_number="+14158675309")
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'twilio-ruby'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

# Initialize Twilio Client
@client = Twilio::REST::Client.new(account_sid, auth_token)

@client.account.incoming_phone_numbers.list(phone_number: '+14158675309')
       .each do |number|
         puts number.phone_number
       end
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.json \
    -d "PhoneNumber=%2B14158675309" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers \
    -d "PhoneNumber=%2B14158675309" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.IncomingPhoneNumber;
import com.twilio.sdk.resource.list.IncomingPhoneNumberList;
import java.util.HashMap;
import java.util.Map;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Build a filter for the IncomingPhoneNumberList
    Map<String, String> params = new HashMap<String, String>();
    
    params.put("PhoneNumber", "+14158675309");
    
    IncomingPhoneNumberList numbers = client.getAccount().getIncomingPhoneNumbers(params);
    
    // Loop over numbers and print out a property for each one.
    for (IncomingPhoneNumber number : numbers) {
      System.out.println(number.getPhoneNumber());
    } 
  }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

# A list of number objects with the properties described above
numbers = client.incoming_phone_numbers \
                .list(phone_number="+14158675309")

for number in numbers:
    print(number.phone_number)
// Download the Node helper library from twilio.com/docs/node/install
// These identifiers are your accountSid and authToken from
// https://www.twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);

const opts = {phoneNumber: '+14158675309'};

client.incomingPhoneNumbers
  .each(opts, (number) => console.log(number.phoneNumber));
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example 
{
  static void Main(string[] args) 
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    var numbers = twilio.ListIncomingPhoneNumbers("+14158675309", null, null, null);
    
    foreach (var number in numbers.IncomingPhoneNumbers)
    {
      Console.WriteLine(number.PhoneNumber);
    }
  }
}
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

// Loop over the list of numbers and echo a property for each one
foreach ($client->account->incoming_phone_numbers->getIterator(0, 50, array(
        "PhoneNumber" => "+14158675309"
    )) as $number
) {
    echo $number->phone_number;
}
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token


# Loop over numbers and print out a property for each one
@client.account.incoming_phone_numbers.list({
  :phone_number => "+14158675309"}).each do |number|
  puts number.phone_number
end
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.base.ResourceSet;
import com.twilio.rest.api.v2010.account.IncomingPhoneNumber;
import com.twilio.type.PhoneNumber;

public class Example {
  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    ResourceSet<IncomingPhoneNumber> numbers =
        IncomingPhoneNumber.reader().setPhoneNumber(new PhoneNumber("+14158675309")).read();

    // Loop over numbers and print out a property for each one.
    for (IncomingPhoneNumber number : numbers) {
      System.out.println(number.getPhoneNumber());
    }
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.incomingPhoneNumbers.list({
    phoneNumber: "+14158675309"
  }, function(err, data) {
    data.incomingPhoneNumbers.forEach(function(number) {
      console.log(number.phoneNumber);
    });
  }
);
出力を表示
  • JSON
  • XML
{
    "page": 0,
    "page_size": 50,
    "uri": "\/2010-04-01\/Accounts\/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\/IncomingPhoneNumbers.xml?PhoneNumber=%2B14158675309",
    "first_page_uri": "\/2010-04-01\/Accounts\/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\/IncomingPhoneNumbers.xml?PhoneNumber=%2B18675309&Page=0&PageSize=50",
    "previous_page_uri": null,
    "next_page_uri": null,
    "incoming_phone_numbers": [
        {
            "sid": "PN3f94c94562ac88dccf16f8859a1a8b25",
            "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
            "friendly_name": "Jenny",
            "phone_number": "+14158675309",
            "voice_url": "http:\/\/demo.twilio.com\/docs/voice.xml",
            "voice_method": "GET",
            "voice_fallback_url": null,
            "voice_fallback_method": null,
            "voice_caller_id_lookup": null,
            "voice_application_sid": null,
            "date_created": "Thu, 13 Nov 2008 07:56:24 +0000",
            "date_updated": "Thu, 13 Nov 2008 08:45:58 +0000",
            "sms_url": null,
            "sms_method": null,
            "sms_fallback_url": null,
            "sms_fallback_method": null,
            "sms_application_sid": AP9b2e38d8c592488c397fc871a82a74ec,
            "capabilities": {
                "voice": true,
                "sms": false,
                "mms": false
            },
            "beta": false
            "status_callback": null,
            "status_callback_method": null,
            "api_version": "2010-04-01",
            "uri": "\/2010-04-01\/Accounts\/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\/IncomingPhoneNumbers\/PN3f94c94562ac88dccf16f8859a1a8b26.json"
        }
    ]
}
<?xml version="1.0" encoding="UTF-8"?>
<TwilioResponse>
    <IncomingPhoneNumbers page="0" pagesize="50" uri="/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.xml?PhoneNumber=%2B14158675309" firstpageuri="/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.xml?PhoneNumber=%2B14158675309&Page=0&PageSize=50" previouspageuri="" nextpageuri="">
        <IncomingPhoneNumber>
            <Sid>PN3f94c94562ac88dccf16f8859a1a8b25</Sid>
            <AccountSid>ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</AccountSid>
            <FriendlyName>Jenny</FriendlyName>
            <PhoneNumber>+14158675309</PhoneNumber>
            <VoiceUrl>http://demo.twilio.com/docs/voice.xml</VoiceUrl>
            <VoiceMethod>GET</VoiceMethod>
            <VoiceFallbackUrl/>
            <VoiceFallbackMethod/>
            <VoiceCallerIdLookup>false</VoiceCallerIdLookup>
            <VoiceApplicationSid/>
            <DateCreated>Thu, 13 Nov 2008 07:56:24 +0000</DateCreated>
            <DateUpdated>Thu, 13 Nov 2008 08:45:58 +0000</DateUpdated>
            <SmsUrl/>
            <SmsMethod/>
            <SmsFallbackUrl/>
            <SmsFallbackMethod/>
            <SmsApplicationSid>AP9b2e38d8c592488c397fc871a82a74ec</SmsApplicationSid>
            <Capabilities>
                <Voice>true</Voice>
                <SMS>false</SMS>
                <MMS>false</MMS>
            </Capabilities>
            <Beta>false</Beta>
            <StatusCallback/>
            <StatusCallbackMethod/>
            <ApiVersion>2010-04-01</ApiVersion>
            <Uri>/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PN3f94c94562ac88dccf16f8859a1a8b26</Uri>
        </IncomingPhoneNumber>
    </IncomingPhoneNumbers>
</TwilioResponse>
完全一致による IncomingPhoneNumbers のフィルタリング
例 3

数字 867 を含むすべてのショート コードのセットを返します。

SDKバージョン:
  • 4.x
  • 5.x
レスポンス形式:
  • JSON
  • xml
SDKバージョン:
  • 6.x
  • 7.x
SDKバージョン:
  • 2.x
  • 3.x
SDKバージョン:
  • 4.x
  • 5.x
SDKバージョン:
  • 5.x
  • 6.x
SDKバージョン:
  • 4.x
  • 5.x
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account;
using Twilio.Types;

class Example
{
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";
        TwilioClient.Init(accountSid, authToken);

        var numbers = IncomingPhoneNumberResource.Read(phoneNumber: new PhoneNumber("867"));

        foreach (var number in numbers)
        {
            Console.WriteLine(number.VoiceUrl);
        }
    }
}
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

$numbers = $client->incomingPhoneNumbers->read(
    array("phoneNumber" => "867")
);
// Loop over the list of numbers and echo a property for each one
foreach ($numbers as $number) {
    echo $number->voiceUrl;
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

# A list of number objects with the properties described above
numbers = client.phone_numbers.list(phone_number="867")
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'twilio-ruby'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

# Initialize Twilio Client
@client = Twilio::REST::Client.new(account_sid, auth_token)

@client.account.incoming_phone_numbers.list(phone_number: '867')
       .each do |number|
         puts number.voice_url
       end
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.json \
    -d "PhoneNumber=867" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers \
    -d "PhoneNumber=867" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.IncomingPhoneNumber;
import com.twilio.sdk.resource.list.IncomingPhoneNumberList;
import java.util.HashMap;
import java.util.Map;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Build a filter for the IncomingPhoneNumberList
    Map<String, String> params = new HashMap<String, String>();
    
    params.put("PhoneNumber", "867");
    
    IncomingPhoneNumberList numbers = client.getAccount().getIncomingPhoneNumbers(params);
    
    // Loop over numbers and print out a property for each one.
    for (IncomingPhoneNumber number : numbers) {
      System.out.println(number.getVoiceUrl());
    } 
  }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

# A list of number objects with the properties described above
numbers = client.incoming_phone_numbers \
                .list(phone_number="867")

for number in numbers:
    print(number.phone_number)
// Download the Node helper library from twilio.com/docs/node/install
// These identifiers are your accountSid and authToken from
// https://www.twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);

const opts = {phoneNumber: '867'};

client.incomingPhoneNumbers
  .each(opts, (number) => console.log(number.voiceUrl));
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example 
{
  static void Main(string[] args) 
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    var numbers = twilio.ListIncomingPhoneNumbers("867", null, null, null);
    
    foreach (var number in numbers.IncomingPhoneNumbers)
    {
      Console.WriteLine(number.VoiceUrl);
    }
  }
}
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

// Loop over the list of numbers and echo a property for each one
foreach ($client->account->incoming_phone_numbers->getIterator(0, 50, array(
        "PhoneNumber" => "867"
    )) as $number
) {
    echo $number->voice_url;
}
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token

# Loop over numbers and print out a property for each one
@client.account.incoming_phone_numbers.list({
  :phone_number => "867"}).each do |number|
  puts number.voice_url
end
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.base.ResourceSet;
import com.twilio.rest.api.v2010.account.IncomingPhoneNumber;
import com.twilio.type.PhoneNumber;

public class Example {
  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    ResourceSet<IncomingPhoneNumber> numbers =
        IncomingPhoneNumber.reader().setPhoneNumber(new PhoneNumber("867")).read();

    // Loop over numbers and print out a property for each one.
    for (IncomingPhoneNumber number : numbers) {
      System.out.println(number.getVoiceUrl());
    }
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.incomingPhoneNumbers.list({
    phoneNumber: "867"
  }, function(err, data) {
    data.incomingPhoneNumbers.forEach(function(number) {
      console.log(number.voiceUrl);
    });
  }
);
出力を表示
  • JSON
  • XML
{
    "page": 0,
    "page_size": 50,
    "uri": "\/2010-04-01\/Accounts\/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\/IncomingPhoneNumbers.xml?PhoneNumber=415",
    "first_page_uri": "\/2010-04-01\/Accounts\/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\/IncomingPhoneNumbers.xml?PhoneNumber=415&Page=0&PageSize=50",
    "previous_page_uri": null,
    "next_page_uri": null,
    "incoming_phone_numbers": [
        {
            "sid": "PN3f94c94562ac88dccf16f8859a1a8b25",
            "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
            "friendly_name": "Jenny",
            "phone_number": "+14158675309",
            "voice_url": "http:\/\/demo.twilio.com\/docs/voice.xml",
            "voice_method": "GET",
            "voice_fallback_url": null,
            "voice_fallback_method": null,
            "voice_caller_id_lookup": null,
            "voice_application_sid": null,
            "date_created": "Thu, 13 Nov 2008 07:56:24 +0000",
            "date_updated": "Thu, 13 Nov 2008 08:45:58 +0000",
            "sms_url": null,
            "sms_method": null,
            "sms_fallback_url": null,
            "sms_fallback_method": null,
            "sms_application_sid": AP9b2e38d8c592488c397fc871a82a74ec,
            "capabilities": {
                "voice": true,
                "sms": false,
                "mms": false
            },
            "beta": false
            "status_callback": null,
            "status_callback_method": null,
            "api_version": "2010-04-01",
            "uri": "\/2010-04-01\/Accounts\/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\/IncomingPhoneNumbers\/PN3f94c94562ac88dccf16f8859a1a8b26.json"
        },
        ...
    ]
}
<?xml version="1.0" encoding="UTF-8"?>
<TwilioResponse>
    <IncomingPhoneNumbers page="0" pagesize="50" uri="/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.xml?PhoneNumber=%2B14158675309" firstpageuri="/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.xml?PhoneNumber=%2B14158675309&Page=0&PageSize=50" previouspageuri="" nextpageuri="">
        <IncomingPhoneNumber>
            <Sid>PN3f94c94562ac88dccf16f8859a1a8b25</Sid>
            <AccountSid>ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</AccountSid>
            <FriendlyName>Jenny</FriendlyName>
            <PhoneNumber>+14158675309</PhoneNumber>
            <VoiceUrl>http://demo.twilio.com/docs/voice.xml</VoiceUrl>
            <VoiceMethod>GET</VoiceMethod>
            <VoiceFallbackUrl/>
            <VoiceFallbackMethod/>
            <VoiceCallerIdLookup>false</VoiceCallerIdLookup>
            <VoiceApplicationSid/>
            <DateCreated>Thu, 13 Nov 2008 07:56:24 +0000</DateCreated>
            <DateUpdated>Thu, 13 Nov 2008 08:45:58 +0000</DateUpdated>
            <SmsUrl/>
            <SmsMethod/>
            <SmsFallbackUrl/>
            <SmsFallbackMethod/>
            <SmsApplicationSid>AP9b2e38d8c592488c397fc871a82a74ec</SmsApplicationSid>
            <Capabilities>
                <Voice>true</Voice>
                <SMS>false</SMS>
                <MMS>false</MMS>
            </Capabilities>
            <Beta>false</Beta>
            <StatusCallback/>
            <StatusCallbackMethod/>
            <ApiVersion>2010-04-01</ApiVersion>
            <Uri>/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PN3f94c94562ac88dccf16f8859a1a8b26</Uri>
        </IncomingPhoneNumber>
    ...
    </IncomingPhoneNumbers>
</TwilioResponse>
部分一致による IncomingPhoneNumbers のフィルタリング

HTTP POST

自分のアカウントの新しい電話番号を購入します。 リクエストに一致する電話番号が見つかると、Twilio はこの番号をアカウントに追加し、初月の料金を課金します。 リクエストに一致する電話番号が見つからない場合、HTTP 400番台のエラーと Twilio エラー コード 21452 が返ります。

POST する番号を検索するには、 AvailablePhoneNumbers リスト リソースのサブリソースを使用します。

必要なパラメーター

リクエストには、次のパラメーターのいずれか 1 つを含める 必要があります

パラメーター 説明
PhoneNumber 購入したい電話番号です。 番号は「+」で始まり、国番号と E.164 フォーマットの番号が続きます。例 : +15105555555。 POST リクエストには必ずこの番号か、または AreaCode パラメーターを含めてください。
AreaCode 新しい着信電話番号の、希望するエリア コードです。 3 桁のアメリカまたはカナダのエリア コードが有効です。 Twilio はこのエリアコードの中で、ランダムに電話番号のプロビジョニングを行います。 POST リクエストには必ずこの番号か、または PhoneNumber パラメーターを含めてください。 (アメリカ、カナダのみ)

両方のパラメーターを含めた場合、Twilio は AreaCode パラメーターを使用し、PhoneNumber パラメーターの指定は無視されます。

オプションパラメーター

リクエストには、次のパラメーターを含めることができます。

パラメーター 説明
FriendlyName 新しい着信電話番号の、人間が読みやすい形式の説明です。 64 文字まで設定できます。 初期値は、この番号のわかりやすい表記になります。
VoiceUrl 新しい番号がダイヤルされた時に、Twilio がリクエストを送信する URL です。VoiceURLは VoiceApplicationSidもしくはTrunkSidが設定されているときは使われません。
VoiceMethod VoiceUrl へリクエストを送信する際に、Twilio が使用する HTTP のメソッドです。 必ず GET または POST のいずれかとします。 初期値は POST です。
VoiceFallbackUrl 上述の Url の TwiML のリクエストまたは実行時にエラーが発生した場合、Twilio がリクエストを送信する URL です。
VoiceFallbackMethod VoiceFallbackUrl へリクエストを送信する際に、Twilio が使用する HTTP のメソッドです。GET または POST のいずれかです。 初期値は POST です。
StatusCallback ステータス パラメーター (通話の終了など) をアプリケーションへ渡すために、Twilio がリクエストを送信する URL です。
StatusCallbackMethod StatusCallback URL へリクエストを送信する際に、Twilio が使用する HTTP のメソッドです。GET または POST のいずれかです。 初期値は POST です。
VoiceCallerIdLookup 発信者の名前を CNAM データベースから検索し、アプリケーションへ通知します。true または false のいずれかです。 初期値は false です。
VoiceApplicationSid 34文字のTwilioアプリケーションSIDが新しい番号へ電話がかかってきた時に使われます。VoiceApplicationSidが存在する場合、Twilioは上記のVoiceURLを無視し、これらの値をアプリケーションにセットします。VoiceApplicationSidが設定された場合、TrunkSidは自動的に削除されます。
TrunkSid トランクを示す34文字のSID,Twilioはこの番号に着信した時に通話をハンドリングします。TrunkSidが存在する場合、Twilioは上記のVoiceURLと Voiceアプリケーションを無視し、これらをトランクにセットします。TrunkSidが設定された場合、VoiceApplicationSidは自動的に削除されます。
SmsUrl この電話番号宛てに SMS が送信された時に、Twilio がリクエストを送信する URL です。
SmsMethod SmsUrl へリクエストを送信する際に、Twilio が使用する HTTP のメソッドです。 必ず GET または POST のいずれかとします。 初期値は POST です。
SmsFallbackUrl 上述の SmsUrl で指定された TwiML のリクエストまたは実行時にエラーが発生した場合、Twilio がリクエストを送信する URL です。
SmsFallbackMethod SmsFallbackUrl へリクエストを送信する際に、Twilio が使用する HTTP のメソッドです。 必ず GET または POST のいずれかとします。 初期値は POST です。
SmsApplicationSid 新しい番号宛の SMS を処理するために Twilio が使用するアプリケーションの、34 文字の sid です。 SmsApplicationSid が設定さている場合、Twilio は上述のすべての URL を無視して、アプリケーションの設定を使用します。
ApiVersion この番号宛の着信通話で使用する Twilio REST API のバージョンです。 省略した場合は、2010-04-01 を使用します。

リクエストが成功すると、Twilio はアカウントに割り当てられた新しい電話番号の表現を返します。

注 : 無料トライアル アカウント使用中は、番号をリクエストすることはできません。 Twilio 電話番号を購入するには、アカウントのアップグレードが必要です。
新しい IncomingPhoneNumber の作成
  • C#
  • curl
  • Java
  • Node.js
  • PHP
  • Python
  • Ruby
SDKバージョン:
  • 4.x
  • 5.x
レスポンス形式:
  • JSON
  • xml
SDKバージョン:
  • 6.x
  • 7.x
SDKバージョン:
  • 2.x
  • 3.x
SDKバージョン:
  • 4.x
  • 5.x
SDKバージョン:
  • 5.x
  • 6.x
SDKバージョン:
  • 4.x
  • 5.x
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account;
using Twilio.Types;
using Twilio.Http;

class Example
{
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";
        TwilioClient.Init(accountSid, authToken);

        var number = IncomingPhoneNumberResource.Create(
            friendlyName: "My Company Line",
            voiceUrl: new Uri("http://demo.twilio.com/docs/voice.xml"),
            phoneNumber: new PhoneNumber("+15105647903"),
            voiceMethod: HttpMethod.Get);

        Console.WriteLine(number.Sid);
    }
}
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

$number = $client->incomingPhoneNumbers
    ->create(
        array(
            "friendlyName" => "My Company Line",
            "voiceUrl" => "http://demo.twilio.com/docs/voice.xml",
            "phoneNumber" => "+15105647903",
            "voiceMethod" => "GET"
        )
    );

echo $number->sid;
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

number = client.phone_numbers.purchase(friendly_name="My Company Line",
    voice_url="http://demo.twilio.com/docs/voice.xml",
    phone_number="+15105647903",
    voice_method="GET")
print(number.sid)
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'twilio-ruby'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

# Initialize Twilio Client
@client = Twilio::REST::Client.new(account_sid, auth_token)

@number = @client.account.incoming_phone_numbers
                 .create(
                   friendly_name: 'My Company Line',
                   voice_url: 'http://demo.twilio.com/docs/voice.xml',
                   phone_number: '+15105647903',
                   voice_method: 'GET'
                 )

puts @number.sms_url
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.json \
    -d "FriendlyName=My%20Company%20Line" \
    -d "VoiceUrl=http://demo.twilio.com/docs/voice.xml" \
    -d "PhoneNumber=%2B15105647903" \
    -d "VoiceMethod=GET" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers \
    -d "FriendlyName=My%20Company%20Line" \
    -d "VoiceUrl=http://demo.twilio.com/docs/voice.xml" \
    -d "PhoneNumber=%2B15105647903" \
    -d "VoiceMethod=GET" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.factory.IncomingPhoneNumberFactory;
import com.twilio.sdk.resource.instance.IncomingPhoneNumber;
import com.twilio.sdk.resource.list.IncomingPhoneNumberList;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Build a filter for the IncomingPhoneNumberList
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    params.add(new BasicNameValuePair("FriendlyName", "My Company Line"));
    params.add(new BasicNameValuePair("VoiceUrl", "http://demo.twilio.com/docs/voice.xml"));
    params.add(new BasicNameValuePair("PhoneNumber", "+15105647903"));
    params.add(new BasicNameValuePair("VoiceMethod", "GET"));
    
    IncomingPhoneNumberFactory numberFactory = client.getAccount().getIncomingPhoneNumberFactory();
    IncomingPhoneNumber number = numberFactory.create(params);
    System.out.println(number.getSid());
  }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

number = client.incoming_phone_numbers \
               .create(friendly_name="My Company Line",
                       voice_url="http://demo.twilio.com/docs/voice.xml",
                       phone_number="+15105647903",
                       voice_method="GET")

print(number.sid)
// Download the Node helper library from twilio.com/docs/node/install
// These consts are your accountSid and authToken from https://www.twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);

client.incomingPhoneNumbers.create({
  friendlyName: 'My Company Line',
  voiceUrl: 'http://demo.twilio.com/docs/voice.xml',
  phoneNumber: '+15105647903',
  voiceMethod: 'GET',
})
.then((number) => console.log(number.sid));
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example 
{
  static void Main(string[] args) 
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    var options = new PhoneNumberOptions();
    options.FriendlyName = "My Company Line";
    options.VoiceUrl = "http://demo.twilio.com/docs/voice.xml";
    options.PhoneNumber = "+15105647903";
    options.VoiceMethod = "GET";
    var number = twilio.AddIncomingPhoneNumber(options);
    
    Console.WriteLine(number.Sid);
  }
}
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Services_Twilio($sid, $token);

$number = $client->account->incoming_phone_numbers->create(
    array(
        "FriendlyName" => "My Company Line",
        "VoiceUrl" => "http://demo.twilio.com/docs/voice.xml",
        "PhoneNumber" => "+15105647903",
        "VoiceMethod" => "GET"
    )
);
echo $number->sid;
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token

number = @client.account.incoming_phone_numbers
  .create(:friendly_name => "My Company Line",
          :voice_url => "http://demo.twilio.com/docs/voice.xml",
          :phone_number => "+15105647903",
          :voice_method => "GET")
puts number.sms_url
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.http.HttpMethod;
import com.twilio.rest.api.v2010.account.IncomingPhoneNumber;
import com.twilio.type.PhoneNumber;

public class Example {
  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    IncomingPhoneNumber number = IncomingPhoneNumber.creator(new PhoneNumber("+15105647903"))
        .setFriendlyName("My Company Line").setVoiceUrl("http://demo.twilio.com/docs/voice.xml")
        .setVoiceMethod(HttpMethod.GET).create();

    System.out.println(number.getSid());
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.incomingPhoneNumbers.create({
    friendlyName: "My Company Line",
    voiceUrl: "http://demo.twilio.com/docs/voice.xml",
    phoneNumber: "+15105647903",
    voiceMethod: "GET"
}, function(err, number) {
    console.log(number.sid);
});
出力を表示
  • JSON
  • XML
{
  "sid": "PN2a0747eba6abf96b7e3c3ff0b4530f6e",
  "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "friendly_name": "My Company Line",
  "phone_number": "+15105647903",
  "voice_url": "http://demo.twilio.com/docs/voice.xml",
  "voice_method": "POST",
  "voice_fallback_url": null,
  "voice_fallback_method": "POST",
  "voice_caller_id_lookup": null,
  "voice_application_sid": null,
  "date_created": "Mon, 16 Aug 2010 23:31:47 +0000",
  "date_updated": "Mon, 16 Aug 2010 23:31:47 +0000",
  "sms_url": null,
  "sms_method": "POST",
  "sms_fallback_url": null,
  "sms_fallback_method": "GET",
  "sms_application_sid": null,
  "capabilities": {
    "voice": true,
    "sms": true
    "mms": false
  },
  "beta": false
  "status_callback": null,
  "status_callback_method": null,
  "api_version": "2010-04-01",
  "uri": "\/2010-04-01\/Accounts\/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\/IncomingPhoneNumbers\/PN2a0747eba6abf96b7e3c3ff0b4530f6e.json"
}
<TwilioResponse>
  <IncomingPhoneNumber>
    <Sid>PN2a0747eba6abf96b7e3c3ff0b4530f6e</Sid>
    <AccountSid>ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</AccountSid>
    <FriendlyName>My Company Line</FriendlyName>
    <PhoneNumber>+15105647903</PhoneNumber>
    <VoiceUrl>http://demo.twilio.com/docs/voice.xml</VoiceUrl>
    <VoiceMethod>GET</VoiceMethod>
    <VoiceFallbackUrl></VoiceFallbackUrl>
    <VoiceFallbackMethod>POST</VoiceFallbackMethod>
    <VoiceCallerIdLookup>false</VoiceCallerIdLookup>
    <VoiceApplicationSid/>
    <DateCreated>Mon, 16 Aug 2010 23:00:23 +0000</DateCreated>
    <DateUpdated>Mon, 16 Aug 2010 23:00:23 +0000</DateUpdated>
    <SmsUrl></SmsUrl>
    <SmsMethod>POST</SmsMethod>
    <SmsFallbackUrl></SmsFallbackUrl>
    <SmsFallbackMethod>GET</SmsFallbackMethod>
    <SmsApplicationSid/>
    <Capabilities>
      <Voice>true</Voice>
      <SMS>true</SMS>
      <MMS>false</MMS>
    </Capabilities>
    <Beta>false</Beta>
    <StatusCallback/>
    <StatusCallbackMethod/>
    <ApiVersion>2010-04-01</ApiVersion>
    <Uri>/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PN2a0747eba6abf96b7e3c3ff0b4530f6e</Uri>
  </IncomingPhoneNumber>
</TwilioResponse>
新しい IncomingPhoneNumber の作成

HTTP PUT

サポートしません。

HTTP DELETE

サポートしません。

国内番号の IncomingPhoneNumber ファクトリ リソース

このリソースに POST すると、アカウントに追加する新しい国内電話番号をリクエストできます。 このサブリソースは、国内電話番号 (無料電話番号ではない) のみを表現します。

リソース URI

/2010-04-01/Accounts/{YourAccountSid}/IncomingPhoneNumbers/Local

HTTP メソッド

HTTP GET

ページ情報を含む <IncomingPhoneNumber> リスト要素の配下の、国内番号の <IncomingPhoneNumbers> 要素のリストを返します。各要素は、アカウントに付与される国内番号 (無料電話番号ではない) を表現します。IncomingPhoneNumber リソースと同じですが、無料通話番号を除外します。

HTTP POST

自分のアカウントに新しい電話番号を追加します。 リクエストに一致する電話番号が見つかると、Twilio はこの番号をアカウントに追加し、初月の料金を課金します。 リクエストに一致する電話番号が見つからない場合、HTTP 400番台 のエラーと Twilio エラー コード 21452 が返ります。

POST する番号を検索するには、 AvailablePhoneNumbers リスト リソースのサブリソースを使用します。

必要なパラメーター

リクエストには PhoneNumber パラメーターを含める 必要があります 。 このサブリソースでは、AreaCode パラメーターはサポートされません。

パラメーター 説明
PhoneNumber 購入したい電話番号です。 番号は「+」で始まり、国番号と E.164 フォーマットの番号が続きます。例 : +15105555555。 POST リクエストには必ずこのパラメーターを含めてください。
オプションパラメーター

このリクエストのオプション パラメーターは、IncomingPhoneNumbers/ リソースに直接 POST する場合と同じ です。

リクエストが成功すると、Twilio はアカウントに割り当てられた新しい電話番号の表現を返します。

注 : 無料トライアル アカウント使用中は、番号をリクエストすることはできません。 Twilio 電話番号を購入するには、アカウントのアップグレードが必要です。

HTTP PUT

サポートしません。

HTTP DELETE

サポートしません。

無料電話番号の IncomingPhoneNumber ファクトリ リソース

このサブリソースは、無料通話番号のみを表現します。 このリソースに POST すると、アカウントに追加する新しい無料電話番号をリクエストできます。

リソース URI

/2010-04-01/Accounts/{YourAccountSid}/IncomingPhoneNumbers/TollFree

HTTP メソッド

HTTP GET

ページ情報を含む <IncomingPhoneNumber> リスト要素の配下の、国内番号の <IncomingPhoneNumbers> 要素のリストを返します。各要素は、アカウントに付与される無料電話番号を表現します。 IncomingPhoneNumber リソースと同じですが、無料通話番号でない番号を除外します。

HTTP POST

自分のアカウントに新しい電話番号を追加します。 リクエストに一致する電話番号が見つかると、Twilio はこの番号をアカウントに追加し、初月の料金を課金します。 リクエストに一致する電話番号が見つからない場合、HTTP 400番台 のエラーと Twilio エラー コード 21452 が返ります。

POST する番号を検索するには、 AvailablePhoneNumbers リスト リソースのサブリソースを使用します。

必要なパラメーター

リクエストには PhoneNumber パラメーターを含める 必要があります 。 このサブリソースでは、AreaCode パラメーターはサポートされません。

パラメーター 説明
PhoneNumber 購入したい電話番号です。 番号は「+」で始まり、国番号と E.164 フォーマットの番号が続きます。例 : +15105555555。 POST リクエストには必ずこのパラメーターを含めてください。
オプションパラメーター

このリクエストのオプション パラメーターは、IncomingPhoneNumbers/ リソースに直接 POST する場合と同じ です。

リクエストが成功すると、Twilio はアカウントに割り当てられた新しい電話番号の表現を返します。

注 : 電話番号のリクエストは、有料版の Twilio アカウントのみ可能です。無料トライアル アカウントではリクエストできません。 Twilio 電話番号を購入したい場合は、アカウントのアップグレードが必要です。

HTTP PUT

サポートしません。

HTTP DELETE

サポートしません。

携帯電話の IncomingPhoneNumber ファクトリー リソース

あなたのアカウントに新しい携帯電話番号をこのリソースにポストすることにより手に入れることができます。サブリソースは携帯電話番号のみを示します。例) フリーダイヤル番号や、ローカル番号ではありません。

リソース URI

/2010-04-01/Accounts/{YourAccountSid}/IncomingPhoneNumbers/Mobile

HTTP メソッド

HTTP GET

ローカル<IncomingPhoneNumber>リストは、ページング情報に含まれる<IncomingPhoneNumbers>リストエレメントにあるエレメントあなたのアカウントにある携帯電話番号を返します。IncomingPhoneNumberリソースと同様に動作し、フリーダイヤル番号、ローカル番号をフィルターします。

HTTP POST

自分のアカウントに新しい電話番号を追加します。 リクエストに一致する電話番号が見つかると、Twilio はこの番号をアカウントに追加し、初月の料金を課金します。 リクエストに一致する電話番号が見つからない場合、HTTP 400番台 のエラーと Twilio エラー コード 21452 が返ります。

POST する番号を検索するには、 AvailablePhoneNumbers リスト リソースのサブリソースを使用します。

必要なパラメーター

リクエストには PhoneNumber パラメーターを含める 必要があります 。 このサブリソースでは、AreaCode パラメーターはサポートされません。

パラメーター 説明
PhoneNumber 購入したい電話番号です。 番号は「+」で始まり、国番号と E.164 フォーマットの番号が続きます。例 : +15105555555。 POST リクエストには必ずこのパラメーターを含めてください。
オプションパラメーター

このリクエストのオプション パラメーターは、IncomingPhoneNumbers/ リソースに直接 POST する場合と同じ です。

リクエストが成功すると、Twilio はアカウントに割り当てられた新しい電話番号の表現を返します。

注 : 無料トライアル アカウント使用中は、番号をリクエストすることはできません。 Twilio 電話番号を購入するには、アカウントのアップグレードが必要です。

HTTP PUT

サポートしません。

HTTP DELETE

サポートしません。

1 / 1
Loading Code Samples...
SDKバージョン:
  • 4.x
  • 5.x
レスポンス形式:
  • JSON
  • xml
SDKバージョン:
  • 6.x
  • 7.x
SDKバージョン:
  • 2.x
  • 3.x
SDKバージョン:
  • 4.x
  • 5.x
SDKバージョン:
  • 5.x
  • 6.x
SDKバージョン:
  • 4.x
  • 5.x
形式:
  • JSON
  • XML
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account;

class Example
{
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";
        TwilioClient.Init(accountSid, authToken);

        var number = IncomingPhoneNumberResource.Fetch("PN2a0747eba6abf96b7e3c3ff0b4530f6e");

        Console.WriteLine(number.PhoneNumber);
    }
}
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$number = $client
    ->incomingPhoneNumbers("PN2a0747eba6abf96b7e3c3ff0b4530f6e")
    ->fetch();

echo $number->phoneNumber;
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

number = client.phone_numbers.get("PN2a0747eba6abf96b7e3c3ff0b4530f6e")
print(number.phone_number)
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

# Initialize Twilio Client
@client = Twilio::REST::Client.new(account_sid, auth_token)

@number = @client.account.incoming_phone_numbers('PN2a0747eba6abf96b7e3c3ff0b4530f6e')
                 .fetch

puts @number.phone_number
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PN2a0747eba6abf96b7e3c3ff0b4530f6e.json \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PN2a0747eba6abf96b7e3c3ff0b4530f6e \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.IncomingPhoneNumber;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Get an object from its sid. If you do not have a sid,
    // check out the list resource examples on this page
    IncomingPhoneNumber number = client.getAccount().getIncomingPhoneNumber("PN2a0747eba6abf96b7e3c3ff0b4530f6e");
    System.out.println(number.getPhoneNumber());
    
  }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

number = client.incoming_phone_numbers("PN2a0747eba6abf96b7e3c3ff0b4530f6e") \
               .fetch()

print(number.phone_number)
// Download the Node helper library from twilio.com/docs/node/install
// These identifiers are your accountSid and authToken from
// https://www.twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);

client.incomingPhoneNumbers('PN2a0747eba6abf96b7e3c3ff0b4530f6e')
  .fetch()
  .then((number) => console.log(number.phoneNumber));
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example 
{
  static void Main(string[] args) 
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    var number = twilio.GetIncomingPhoneNumber("PN2a0747eba6abf96b7e3c3ff0b4530f6e");
    
    Console.WriteLine(number.PhoneNumber);
  }
}
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$number = $client->account->incoming_phone_numbers->get("PN2a0747eba6abf96b7e3c3ff0b4530f6e");
echo $number->phone_number;
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token

# Get an object from its sid. If you do not have a sid,
# check out the list resource examples on this page
@number = @client.account.incoming_phone_numbers.get("PN2a0747eba6abf96b7e3c3ff0b4530f6e")
puts @number.phone_number
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.IncomingPhoneNumber;

public class Example {
  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    // Get an object from its sid. If you do not have a sid,
    // check out the list resource examples on this page
    IncomingPhoneNumber number =
        IncomingPhoneNumber.fetcher("PN2a0747eba6abf96b7e3c3ff0b4530f6e").fetch();

    System.out.println(number.getPhoneNumber());
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.incomingPhoneNumbers("PN2a0747eba6abf96b7e3c3ff0b4530f6e").get(function(err, number) {
    console.log(number.phoneNumber);
});
{
  "sid": "PN2a0747eba6abf96b7e3c3ff0b4530f6e",
  "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "friendly_name": "My Company Line",
  "phone_number": "+15105647903",
  "voice_url": "http://demo.twilio.com/docs/voice.xml",
  "voice_method": "POST",
  "voice_fallback_url": null,
  "voice_fallback_method": "POST",
  "status_callback": null,
  "status_callback_method": null,
  "voice_caller_id_lookup": null,
  "voice_application_sid": null,
  "date_created": "Mon, 16 Aug 2010 23:00:23 +0000",
  "date_updated": "Mon, 16 Aug 2010 23:00:23 +0000",
  "sms_url": null,
  "sms_method": "POST",
  "sms_fallback_url": null,
  "sms_fallback_method": "GET",
  "sms_application_sid": "AP9b2e38d8c592488c397fc871a82a74ec",
  "capabilities": {
    "voice": true,
    "sms": true,
    "mms": false
  },
  "beta": false
  "api_version": "2010-04-01",
  "uri": "\/2010-04-01\/Accounts\/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\/IncomingPhoneNumbers\/PN2a0747eba6abf96b7e3c3ff0b4530f6e.json"
}
<TwilioResponse>
  <IncomingPhoneNumber>
    <Sid>PN2a0747eba6abf96b7e3c3ff0b4530f6e</Sid>
    <AccountSid>ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</AccountSid>
    <FriendlyName>My Company Line</FriendlyName>
    <PhoneNumber>+15105647903</PhoneNumber>
    <VoiceUrl>http://demo.twilio.com/docs/voice.xml</VoiceUrl>
    <VoiceMethod>POST</VoiceMethod>
    <VoiceFallbackUrl/>
    <VoiceFallbackMethod>POST</VoiceFallbackMethod>
    <StatusCallback/>
    <StatusCallbackMethod/>
    <VoiceCallerIdLookup>false</VoiceCallerIdLookup>
    <VoiceApplicationSid/>
    <DateCreated>Mon, 16 Aug 2010 23:00:23 +0000</DateCreated>
    <DateUpdated>Mon, 16 Aug 2010 23:00:23 +0000</DateUpdated>
    <SmsUrl/>
    <SmsMethod>POST</SmsMethod>
    <SmsFallbackUrl/>
    <SmsFallbackMethod>GET</SmsFallbackMethod>
    <SmsApplicationSid>AP9b2e38d8c592488c397fc871a82a74ec</SmsApplicationSid>
    <Capabilities>
      <Voice>true</Voice>
      <SMS>true</SMS>
      <MMS>false</MMS>
    </Capabilities>
    <Beta>false</Beta>
    <ApiVersion>2010-04-01</ApiVersion>
    <Uri>/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PN2a0747eba6abf96b7e3c3ff0b4530f6e</Uri>
  </IncomingPhoneNumber>
</TwilioResponse>
SDKバージョン:
  • 4.x
  • 5.x
レスポンス形式:
  • JSON
  • xml
SDKバージョン:
  • 6.x
  • 7.x
SDKバージョン:
  • 2.x
  • 3.x
SDKバージョン:
  • 4.x
  • 5.x
SDKバージョン:
  • 5.x
  • 6.x
SDKバージョン:
  • 4.x
  • 5.x
形式:
  • JSON
  • XML
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account;

class Example
{
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";
        TwilioClient.Init(accountSid, authToken);

        IncomingPhoneNumberResource.Update(
            "PN2a0747eba6abf96b7e3c3ff0b4530f6e",
            voiceUrl: new Uri("http://demo.twilio.com/docs/voice.xml"),
            smsUrl: new Uri("http://demo.twilio.com/docs/sms.xml"));
    }
}
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$number = $client
    ->incomingPhoneNumbers("PN2a0747eba6abf96b7e3c3ff0b4530f6e")
    ->update(
        array(
            "voiceUrl" => "http://demo.twilio.com/docs/voice.xml",
            "smsUrl" => "http://demo.twilio.com/docs/sms.xml"
        )
    );

echo $number->voiceUrl;
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

number = client.phone_numbers.update("PN2a0747eba6abf96b7e3c3ff0b4530f6e", voice_url="http://demo.twilio.com/docs/voice.xml",
    sms_url="http://demo.twilio.com/docs/sms.xml")
print(number.voice_url)
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'twilio-ruby'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

# Initialize Twilio Client
@client = Twilio::REST::Client.new(account_sid, auth_token)

@number = @client.account
                 .incoming_phone_numbers('PN2a0747eba6abf96b7e3c3ff0b4530f6e')
                 .fetch

@number.update(
  voice_url: 'http://demo.twilio.com/docs/voice.xml',
  sms_url: 'http://demo.twilio.com/docs/sms.xml'
)

puts @number.voice_url
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PN2a0747eba6abf96b7e3c3ff0b4530f6e.json \
    -d "VoiceUrl=http://demo.twilio.com/docs/voice.xml" \
    -d "SmsUrl=http://demo.twilio.com/docs/sms.xml" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PN2a0747eba6abf96b7e3c3ff0b4530f6e \
    -d "VoiceUrl=http://demo.twilio.com/docs/voice.xml" \
    -d "SmsUrl=http://demo.twilio.com/docs/sms.xml" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.IncomingPhoneNumber;
import com.twilio.sdk.resource.list.IncomingPhoneNumberList;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Get an object from its sid. If you do not have a sid,
    // check out the list resource examples on this page
    IncomingPhoneNumber number = client.getAccount().getIncomingPhoneNumber("PN2a0747eba6abf96b7e3c3ff0b4530f6e");
    // Build a filter for the IncomingPhoneNumberList
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    params.add(new BasicNameValuePair("VoiceUrl", "http://demo.twilio.com/docs/voice.xml"));
    params.add(new BasicNameValuePair("SmsUrl", "http://demo.twilio.com/docs/sms.xml"));
    number.update(params); 
  }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

number = client.incoming_phone_numbers("PN2a0747eba6abf96b7e3c3ff0b4530f6e") \
               .update(voice_url="http://demo.twilio.com/docs/voice.xml",
                       sms_url="http://demo.twilio.com/docs/sms.xml")

print(number.voice_url)
// Download the Node helper library from twilio.com/docs/node/install
// These identifiers are your accountSid and authToken from
// https://www.twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);

client.incomingPhoneNumbers('PN2a0747eba6abf96b7e3c3ff0b4530f6e')
  .update({
    voiceUrl: 'http://demo.twilio.com/docs/voice.xml',
    smsUrl: 'http://demo.twilio.com/docs/sms.xml',
  })
  .then((number) => console.log(number.voiceUrl));
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example 
{
  static void Main(string[] args) 
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    var options = new PhoneNumberOptions();
    options.VoiceUrl = "http://demo.twilio.com/docs/voice.xml";
    options.SmsUrl = "http://demo.twilio.com/docs/sms.xml";
    
    twilio.UpdateIncomingPhoneNumber("PN2a0747eba6abf96b7e3c3ff0b4530f6e", options);
  }
}
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$number = $client->account->incoming_phone_numbers->get("PN2a0747eba6abf96b7e3c3ff0b4530f6e");
$number->update(array(
        "VoiceUrl" => "http://demo.twilio.com/docs/voice.xml",
    "SmsUrl" => "http://demo.twilio.com/docs/sms.xml"
    ));
echo $number->voice_url;
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token

# Get an object from its sid. If you do not have a sid,
# check out the list resource examples on this page
@number = @client.account.incoming_phone_numbers.get("PN2a0747eba6abf96b7e3c3ff0b4530f6e")
@number.update(:voice_url => "http://demo.twilio.com/docs/voice.xml",
               :sms_url => "http://demo.twilio.com/docs/sms.xml")
puts @number.voice_url
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.IncomingPhoneNumber;

public class Example {
  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    // Get an object from its sid. If you do not have a sid,
    // check out the list resource examples on this page
    IncomingPhoneNumber number = IncomingPhoneNumber.updater("PN2a0747eba6abf96b7e3c3ff0b4530f6e")
        .setVoiceUrl("http://demo.twilio.com/docs/voice.xml")
        .setSmsUrl("http://demo.twilio.com/docs/sms.xml").update();

    System.out.println(number.getDateUpdated());
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.incomingPhoneNumbers("PN2a0747eba6abf96b7e3c3ff0b4530f6e").update({
    voiceUrl: "http://demo.twilio.com/docs/voice.xml",
    smsUrl: "http://demo.twilio.com/docs/sms.xml"
}, function(err, number) {
    console.log(number.voiceUrl);
});
{
  "sid": "PN2a0747eba6abf96b7e3c3ff0b4530f6e",
  "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "friendly_name": "My Company Line",
  "phone_number": "+15105647903",
  "voice_url": "http://demo.twilio.com/docs/voice.xml",
  "voice_method": "POST",
  "voice_fallback_url": null,
  "voice_fallback_method": "POST",
  "voice_caller_id_lookup": null,
  "voice_application_sid": null,
  "date_created": "Mon, 16 Aug 2010 23:00:23 +0000",
  "date_updated": "Mon, 16 Aug 2010 23:00:23 +0000",
  "sms_url": "http://demo.twilio.com/docs/sms.xml",
  "sms_method": "POST",
  "sms_fallback_url": null,
  "sms_fallback_method": "GET",
  "sms_application_sid": null,
  "capabilities": {
    "voice": true,
    "sms": true,
    "mms": false
  },
  "beta": false
  "status_callback": null,
  "status_callback_method": null,
  "api_version": "2010-04-01",
  "uri": "\/2010-04-01\/Accounts\/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\/IncomingPhoneNumbers\/PN2a0747eba6abf96b7e3c3ff0b4530f6e.json"
}
<TwilioResponse>
  <IncomingPhoneNumber>
    <Sid>PN2a0747eba6abf96b7e3c3ff0b4530f6e</Sid>
    <AccountSid>ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</AccountSid>
    <FriendlyName>My Company Line</FriendlyName>
    <PhoneNumber>+15105647903</PhoneNumber>
    <VoiceUrl>http://demo.twilio.com/docs/voice.xml</VoiceUrl>
    <VoiceMethod>POST</VoiceMethod>
    <VoiceFallbackUrl/>
    <VoiceFallbackMethod>POST</VoiceFallbackMethod>
    <VoiceCallerIdLookup>false</VoiceCallerIdLookup>
    <VoiceApplicationSid/>
    <DateCreated>Mon, 16 Aug 2010 23:00:23 +0000</DateCreated>
    <DateUpdated>Mon, 16 Aug 2010 23:00:23 +0000</DateUpdated>
    <SmsUrl>http://demo.twilio.com/docs/sms.xml</SmsUrl>
    <SmsMethod>POST</SmsMethod>
    <SmsFallbackUrl/>
    <SmsFallbackMethod>GET</SmsFallbackMethod>
    <SmsApplicationSid/>
    <Capabilities>
      <Voice>true</Voice>
      <SMS>true</SMS>
      <MMS>false</MMS>
    </Capabilities>
    <Beta>false</Beta>
    <StatusCallback/>
    <StatusCallbackMethod/>
    <ApiVersion>2010-04-01</ApiVersion>
    <Uri>/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PN2a0747eba6abf96b7e3c3ff0b4530f6e</Uri>
  </IncomingPhoneNumber>
</TwilioResponse>
SDKバージョン:
  • 4.x
  • 5.x
レスポンス形式:
  • JSON
  • xml
SDKバージョン:
  • 6.x
  • 7.x
SDKバージョン:
  • 2.x
  • 3.x
SDKバージョン:
  • 4.x
  • 5.x
SDKバージョン:
  • 5.x
  • 6.x
SDKバージョン:
  • 4.x
  • 5.x
形式:
  • JSON
  • XML
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account;

class Example
{
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";
        TwilioClient.Init(accountSid, authToken);

        var numbers = IncomingPhoneNumberResource.Read();

        foreach (var number in numbers)
        {
            Console.WriteLine(number.PhoneNumber);
        }
    }
}
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

// Loop over the list of numbers and echo a property for each one
foreach ($client->incomingPhoneNumbers->read() as $number) {
    echo $number->phoneNumber;
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

# A list of number objects with the properties described above
numbers = client.phone_numbers.list()
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'twilio-ruby'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

# Initialize Twilio Client
@client = Twilio::REST::Client.new(account_sid, auth_token)

@client.account.incoming_phone_numbers.list.each do |number|
  puts number.phone_number
end
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.json \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.IncomingPhoneNumber;
import com.twilio.sdk.resource.list.IncomingPhoneNumberList;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);
    
    IncomingPhoneNumberList numbers = client.getAccount().getIncomingPhoneNumbers();
    
    // Loop over numbers and print out a property for each one.
    for (IncomingPhoneNumber number : numbers) {
      System.out.println(number.getPhoneNumber());
    } 
  }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

# A list of number objects with the properties described above
for number in client.incoming_phone_numbers.list():
    print(number.phone_number)
// Download the Node helper library from twilio.com/docs/node/install
// These identifiers are your accountSid and authToken from
// https://www.twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);

client.incomingPhoneNumbers.each((number) => console.log(number.phoneNumber));
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example 
{
  static void Main(string[] args) 
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    var numbers = twilio.ListIncomingPhoneNumbers(null, null, null, null);
    
    foreach (var number in numbers.IncomingPhoneNumbers)
    {
      Console.WriteLine(number.PhoneNumber);
    }
  }
}
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

// Loop over the list of numbers and echo a property for each one
foreach ($client->account->incoming_phone_numbers as $number) {
    echo $number->phone_number;
}
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token


# Loop over numbers and print out a property for each one
@client.account.incoming_phone_numbers.list.each do |number|
  puts number.phone_number
end
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.base.ResourceSet;
import com.twilio.rest.api.v2010.account.IncomingPhoneNumber;

public class Example {
  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    ResourceSet<IncomingPhoneNumber> numbers = IncomingPhoneNumber.reader().read();

    // Loop over numbers and print out a property for each one.
    for (IncomingPhoneNumber number : numbers) {
      System.out.println(number.getPhoneNumber());
    }
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.incomingPhoneNumbers.list(function(err, data) {
    data.incomingPhoneNumbers.forEach(function(number) {
        console.log(number.phoneNumber);
    });
});
{
  "page": 0,
  "page_size": 50,
  "uri": "\/2010-04-01\/Accounts\/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\/IncomingPhoneNumbers.json",
  "first_page_uri": "\/2010-04-01\/Accounts\/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\/IncomingPhoneNumbers.json?Page=0&PageSize=50",
  "previous_page_uri": null,
  "next_page_uri": null,
  "incoming_phone_numbers": [
    {
      "sid": "PN3f94c94562ac88dccf16f8859a1a8b25",
      "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
      "friendly_name": "Long Play",
      "phone_number": "+14152374451",
      "voice_url": "http:\/\/demo.twilio.com\/docs/voice.xml",
      "voice_method": "GET",
      "voice_fallback_url": null,
      "voice_fallback_method": null,
      "voice_caller_id_lookup": null,
      "voice_application_sid": null,
      "date_created": "Thu, 13 Nov 2008 07:56:24 +0000",
      "date_updated": "Thu, 13 Nov 2008 08:45:58 +0000",
      "sms_url": null,
      "sms_method": null,
      "sms_fallback_url": null,
      "sms_fallback_method": null,
      "sms_application_sid": AP9b2e38d8c592488c397fc871a82a74ec,
      "capabilities": {
        "voice": true,
        "sms": false,
        "mms": false
      },
      "beta": false
      "status_callback": null,
      "status_callback_method": null,
      "api_version": "2010-04-01",
      "uri": "\/2010-04-01\/Accounts\/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\/IncomingPhoneNumbers\/PN3f94c94562ac88dccf16f8859a1a8b25.json"
    },
    ...
  ]
}
<TwilioResponse>
  <IncomingPhoneNumbers page="0" pagesize="50" uri="/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers" firstpageuri="/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers?Page=0&PageSize=50" previouspageuri="" nextpageuri="">
    <IncomingPhoneNumber>
      <Sid>PN3f94c94562ac88dccf16f8859a1a8b25</Sid>
      <AccountSid>ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</AccountSid>
      <FriendlyName>Long Play</FriendlyName>
      <PhoneNumber>+14152374451</PhoneNumber>
      <VoiceUrl>http://demo.twilio.com/docs/voice.xml</VoiceUrl>
      <VoiceMethod>GET</VoiceMethod>
      <VoiceFallbackUrl/>
      <VoiceFallbackMethod/>
      <VoiceCallerIdLookup>false</VoiceCallerIdLookup>
      <VoiceApplicationSid/>
      <DateCreated>Thu, 13 Nov 2008 07:56:24 +0000</DateCreated>
      <DateUpdated>Thu, 13 Nov 2008 08:45:58 +0000</DateUpdated>
      <SmsUrl/>
      <SmsMethod/>
      <SmsFallbackUrl/>
      <SmsFallbackMethod/>
      <SmsApplicationSid>AP9b2e38d8c592488c397fc871a82a74ec</SmsApplicationSid>
      <Capabilities>
        <Voice>true</Voice>
        <SMS>false</SMS>
        <MMS>false</MMS>
      </Capabilities>
      <Beta>false</Beta>
      <StatusCallback/>
      <StatusCallbackMethod/>
      <ApiVersion>2010-04-01</ApiVersion>
      <Uri>/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PN3f94c94562ac88dccf16f8859a1a8b25</Uri>
    </IncomingPhoneNumber>
    ...
  </IncomingPhoneNumbers>
</TwilioResponse>
SDKバージョン:
  • 4.x
  • 5.x
レスポンス形式:
  • JSON
  • xml
SDKバージョン:
  • 6.x
  • 7.x
SDKバージョン:
  • 2.x
  • 3.x
SDKバージョン:
  • 4.x
  • 5.x
SDKバージョン:
  • 5.x
  • 6.x
SDKバージョン:
  • 4.x
  • 5.x
形式:
  • JSON
  • XML
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account;
using Twilio.Types;

class Example
{
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";
        TwilioClient.Init(accountSid, authToken);

        var numbers = IncomingPhoneNumberResource.Read(
            phoneNumber: new PhoneNumber("+14158675309"));

        foreach (var number in numbers)
        {
            Console.WriteLine(number.PhoneNumber);
        }
    }
}
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

$numbers = $client->incomingPhoneNumbers->read(
    array("phoneNumber" => "+14158675309")
);
// Loop over the list of numbers and echo a property for each one
foreach ($numbers as $number) {
    echo $number->phoneNumber;
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

# A list of number objects with the properties described above
numbers = client.phone_numbers.list(phone_number="+14158675309")
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'twilio-ruby'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

# Initialize Twilio Client
@client = Twilio::REST::Client.new(account_sid, auth_token)

@client.account.incoming_phone_numbers.list(phone_number: '+14158675309')
       .each do |number|
         puts number.phone_number
       end
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.json \
    -d "PhoneNumber=%2B14158675309" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers \
    -d "PhoneNumber=%2B14158675309" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.IncomingPhoneNumber;
import com.twilio.sdk.resource.list.IncomingPhoneNumberList;
import java.util.HashMap;
import java.util.Map;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Build a filter for the IncomingPhoneNumberList
    Map<String, String> params = new HashMap<String, String>();
    
    params.put("PhoneNumber", "+14158675309");
    
    IncomingPhoneNumberList numbers = client.getAccount().getIncomingPhoneNumbers(params);
    
    // Loop over numbers and print out a property for each one.
    for (IncomingPhoneNumber number : numbers) {
      System.out.println(number.getPhoneNumber());
    } 
  }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

# A list of number objects with the properties described above
numbers = client.incoming_phone_numbers \
                .list(phone_number="+14158675309")

for number in numbers:
    print(number.phone_number)
// Download the Node helper library from twilio.com/docs/node/install
// These identifiers are your accountSid and authToken from
// https://www.twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);

const opts = {phoneNumber: '+14158675309'};

client.incomingPhoneNumbers
  .each(opts, (number) => console.log(number.phoneNumber));
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example 
{
  static void Main(string[] args) 
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    var numbers = twilio.ListIncomingPhoneNumbers("+14158675309", null, null, null);
    
    foreach (var number in numbers.IncomingPhoneNumbers)
    {
      Console.WriteLine(number.PhoneNumber);
    }
  }
}
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

// Loop over the list of numbers and echo a property for each one
foreach ($client->account->incoming_phone_numbers->getIterator(0, 50, array(
        "PhoneNumber" => "+14158675309"
    )) as $number
) {
    echo $number->phone_number;
}
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token


# Loop over numbers and print out a property for each one
@client.account.incoming_phone_numbers.list({
  :phone_number => "+14158675309"}).each do |number|
  puts number.phone_number
end
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.base.ResourceSet;
import com.twilio.rest.api.v2010.account.IncomingPhoneNumber;
import com.twilio.type.PhoneNumber;

public class Example {
  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    ResourceSet<IncomingPhoneNumber> numbers =
        IncomingPhoneNumber.reader().setPhoneNumber(new PhoneNumber("+14158675309")).read();

    // Loop over numbers and print out a property for each one.
    for (IncomingPhoneNumber number : numbers) {
      System.out.println(number.getPhoneNumber());
    }
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.incomingPhoneNumbers.list({
    phoneNumber: "+14158675309"
  }, function(err, data) {
    data.incomingPhoneNumbers.forEach(function(number) {
      console.log(number.phoneNumber);
    });
  }
);
{
    "page": 0,
    "page_size": 50,
    "uri": "\/2010-04-01\/Accounts\/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\/IncomingPhoneNumbers.xml?PhoneNumber=%2B14158675309",
    "first_page_uri": "\/2010-04-01\/Accounts\/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\/IncomingPhoneNumbers.xml?PhoneNumber=%2B18675309&Page=0&PageSize=50",
    "previous_page_uri": null,
    "next_page_uri": null,
    "incoming_phone_numbers": [
        {
            "sid": "PN3f94c94562ac88dccf16f8859a1a8b25",
            "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
            "friendly_name": "Jenny",
            "phone_number": "+14158675309",
            "voice_url": "http:\/\/demo.twilio.com\/docs/voice.xml",
            "voice_method": "GET",
            "voice_fallback_url": null,
            "voice_fallback_method": null,
            "voice_caller_id_lookup": null,
            "voice_application_sid": null,
            "date_created": "Thu, 13 Nov 2008 07:56:24 +0000",
            "date_updated": "Thu, 13 Nov 2008 08:45:58 +0000",
            "sms_url": null,
            "sms_method": null,
            "sms_fallback_url": null,
            "sms_fallback_method": null,
            "sms_application_sid": AP9b2e38d8c592488c397fc871a82a74ec,
            "capabilities": {
                "voice": true,
                "sms": false,
                "mms": false
            },
            "beta": false
            "status_callback": null,
            "status_callback_method": null,
            "api_version": "2010-04-01",
            "uri": "\/2010-04-01\/Accounts\/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\/IncomingPhoneNumbers\/PN3f94c94562ac88dccf16f8859a1a8b26.json"
        }
    ]
}
<?xml version="1.0" encoding="UTF-8"?>
<TwilioResponse>
    <IncomingPhoneNumbers page="0" pagesize="50" uri="/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.xml?PhoneNumber=%2B14158675309" firstpageuri="/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.xml?PhoneNumber=%2B14158675309&Page=0&PageSize=50" previouspageuri="" nextpageuri="">
        <IncomingPhoneNumber>
            <Sid>PN3f94c94562ac88dccf16f8859a1a8b25</Sid>
            <AccountSid>ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</AccountSid>
            <FriendlyName>Jenny</FriendlyName>
            <PhoneNumber>+14158675309</PhoneNumber>
            <VoiceUrl>http://demo.twilio.com/docs/voice.xml</VoiceUrl>
            <VoiceMethod>GET</VoiceMethod>
            <VoiceFallbackUrl/>
            <VoiceFallbackMethod/>
            <VoiceCallerIdLookup>false</VoiceCallerIdLookup>
            <VoiceApplicationSid/>
            <DateCreated>Thu, 13 Nov 2008 07:56:24 +0000</DateCreated>
            <DateUpdated>Thu, 13 Nov 2008 08:45:58 +0000</DateUpdated>
            <SmsUrl/>
            <SmsMethod/>
            <SmsFallbackUrl/>
            <SmsFallbackMethod/>
            <SmsApplicationSid>AP9b2e38d8c592488c397fc871a82a74ec</SmsApplicationSid>
            <Capabilities>
                <Voice>true</Voice>
                <SMS>false</SMS>
                <MMS>false</MMS>
            </Capabilities>
            <Beta>false</Beta>
            <StatusCallback/>
            <StatusCallbackMethod/>
            <ApiVersion>2010-04-01</ApiVersion>
            <Uri>/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PN3f94c94562ac88dccf16f8859a1a8b26</Uri>
        </IncomingPhoneNumber>
    </IncomingPhoneNumbers>
</TwilioResponse>
SDKバージョン:
  • 4.x
  • 5.x
レスポンス形式:
  • JSON
  • xml
SDKバージョン:
  • 6.x
  • 7.x
SDKバージョン:
  • 2.x
  • 3.x
SDKバージョン:
  • 4.x
  • 5.x
SDKバージョン:
  • 5.x
  • 6.x
SDKバージョン:
  • 4.x
  • 5.x
形式:
  • JSON
  • XML
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account;
using Twilio.Types;

class Example
{
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";
        TwilioClient.Init(accountSid, authToken);

        var numbers = IncomingPhoneNumberResource.Read(phoneNumber: new PhoneNumber("867"));

        foreach (var number in numbers)
        {
            Console.WriteLine(number.VoiceUrl);
        }
    }
}
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

$numbers = $client->incomingPhoneNumbers->read(
    array("phoneNumber" => "867")
);
// Loop over the list of numbers and echo a property for each one
foreach ($numbers as $number) {
    echo $number->voiceUrl;
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

# A list of number objects with the properties described above
numbers = client.phone_numbers.list(phone_number="867")
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'twilio-ruby'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

# Initialize Twilio Client
@client = Twilio::REST::Client.new(account_sid, auth_token)

@client.account.incoming_phone_numbers.list(phone_number: '867')
       .each do |number|
         puts number.voice_url
       end
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.json \
    -d "PhoneNumber=867" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers \
    -d "PhoneNumber=867" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.IncomingPhoneNumber;
import com.twilio.sdk.resource.list.IncomingPhoneNumberList;
import java.util.HashMap;
import java.util.Map;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Build a filter for the IncomingPhoneNumberList
    Map<String, String> params = new HashMap<String, String>();
    
    params.put("PhoneNumber", "867");
    
    IncomingPhoneNumberList numbers = client.getAccount().getIncomingPhoneNumbers(params);
    
    // Loop over numbers and print out a property for each one.
    for (IncomingPhoneNumber number : numbers) {
      System.out.println(number.getVoiceUrl());
    } 
  }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

# A list of number objects with the properties described above
numbers = client.incoming_phone_numbers \
                .list(phone_number="867")

for number in numbers:
    print(number.phone_number)
// Download the Node helper library from twilio.com/docs/node/install
// These identifiers are your accountSid and authToken from
// https://www.twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);

const opts = {phoneNumber: '867'};

client.incomingPhoneNumbers
  .each(opts, (number) => console.log(number.voiceUrl));
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example 
{
  static void Main(string[] args) 
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    var numbers = twilio.ListIncomingPhoneNumbers("867", null, null, null);
    
    foreach (var number in numbers.IncomingPhoneNumbers)
    {
      Console.WriteLine(number.VoiceUrl);
    }
  }
}
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

// Loop over the list of numbers and echo a property for each one
foreach ($client->account->incoming_phone_numbers->getIterator(0, 50, array(
        "PhoneNumber" => "867"
    )) as $number
) {
    echo $number->voice_url;
}
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token

# Loop over numbers and print out a property for each one
@client.account.incoming_phone_numbers.list({
  :phone_number => "867"}).each do |number|
  puts number.voice_url
end
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.base.ResourceSet;
import com.twilio.rest.api.v2010.account.IncomingPhoneNumber;
import com.twilio.type.PhoneNumber;

public class Example {
  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    ResourceSet<IncomingPhoneNumber> numbers =
        IncomingPhoneNumber.reader().setPhoneNumber(new PhoneNumber("867")).read();

    // Loop over numbers and print out a property for each one.
    for (IncomingPhoneNumber number : numbers) {
      System.out.println(number.getVoiceUrl());
    }
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.incomingPhoneNumbers.list({
    phoneNumber: "867"
  }, function(err, data) {
    data.incomingPhoneNumbers.forEach(function(number) {
      console.log(number.voiceUrl);
    });
  }
);
{
    "page": 0,
    "page_size": 50,
    "uri": "\/2010-04-01\/Accounts\/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\/IncomingPhoneNumbers.xml?PhoneNumber=415",
    "first_page_uri": "\/2010-04-01\/Accounts\/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\/IncomingPhoneNumbers.xml?PhoneNumber=415&Page=0&PageSize=50",
    "previous_page_uri": null,
    "next_page_uri": null,
    "incoming_phone_numbers": [
        {
            "sid": "PN3f94c94562ac88dccf16f8859a1a8b25",
            "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
            "friendly_name": "Jenny",
            "phone_number": "+14158675309",
            "voice_url": "http:\/\/demo.twilio.com\/docs/voice.xml",
            "voice_method": "GET",
            "voice_fallback_url": null,
            "voice_fallback_method": null,
            "voice_caller_id_lookup": null,
            "voice_application_sid": null,
            "date_created": "Thu, 13 Nov 2008 07:56:24 +0000",
            "date_updated": "Thu, 13 Nov 2008 08:45:58 +0000",
            "sms_url": null,
            "sms_method": null,
            "sms_fallback_url": null,
            "sms_fallback_method": null,
            "sms_application_sid": AP9b2e38d8c592488c397fc871a82a74ec,
            "capabilities": {
                "voice": true,
                "sms": false,
                "mms": false
            },
            "beta": false
            "status_callback": null,
            "status_callback_method": null,
            "api_version": "2010-04-01",
            "uri": "\/2010-04-01\/Accounts\/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\/IncomingPhoneNumbers\/PN3f94c94562ac88dccf16f8859a1a8b26.json"
        },
        ...
    ]
}
<?xml version="1.0" encoding="UTF-8"?>
<TwilioResponse>
    <IncomingPhoneNumbers page="0" pagesize="50" uri="/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.xml?PhoneNumber=%2B14158675309" firstpageuri="/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.xml?PhoneNumber=%2B14158675309&Page=0&PageSize=50" previouspageuri="" nextpageuri="">
        <IncomingPhoneNumber>
            <Sid>PN3f94c94562ac88dccf16f8859a1a8b25</Sid>
            <AccountSid>ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</AccountSid>
            <FriendlyName>Jenny</FriendlyName>
            <PhoneNumber>+14158675309</PhoneNumber>
            <VoiceUrl>http://demo.twilio.com/docs/voice.xml</VoiceUrl>
            <VoiceMethod>GET</VoiceMethod>
            <VoiceFallbackUrl/>
            <VoiceFallbackMethod/>
            <VoiceCallerIdLookup>false</VoiceCallerIdLookup>
            <VoiceApplicationSid/>
            <DateCreated>Thu, 13 Nov 2008 07:56:24 +0000</DateCreated>
            <DateUpdated>Thu, 13 Nov 2008 08:45:58 +0000</DateUpdated>
            <SmsUrl/>
            <SmsMethod/>
            <SmsFallbackUrl/>
            <SmsFallbackMethod/>
            <SmsApplicationSid>AP9b2e38d8c592488c397fc871a82a74ec</SmsApplicationSid>
            <Capabilities>
                <Voice>true</Voice>
                <SMS>false</SMS>
                <MMS>false</MMS>
            </Capabilities>
            <Beta>false</Beta>
            <StatusCallback/>
            <StatusCallbackMethod/>
            <ApiVersion>2010-04-01</ApiVersion>
            <Uri>/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PN3f94c94562ac88dccf16f8859a1a8b26</Uri>
        </IncomingPhoneNumber>
    ...
    </IncomingPhoneNumbers>
</TwilioResponse>
SDKバージョン:
  • 4.x
  • 5.x
レスポンス形式:
  • JSON
  • xml
SDKバージョン:
  • 6.x
  • 7.x
SDKバージョン:
  • 2.x
  • 3.x
SDKバージョン:
  • 4.x
  • 5.x
SDKバージョン:
  • 5.x
  • 6.x
SDKバージョン:
  • 4.x
  • 5.x
形式:
  • JSON
  • XML
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account;
using Twilio.Types;
using Twilio.Http;

class Example
{
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";
        TwilioClient.Init(accountSid, authToken);

        var number = IncomingPhoneNumberResource.Create(
            friendlyName: "My Company Line",
            voiceUrl: new Uri("http://demo.twilio.com/docs/voice.xml"),
            phoneNumber: new PhoneNumber("+15105647903"),
            voiceMethod: HttpMethod.Get);

        Console.WriteLine(number.Sid);
    }
}
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

$number = $client->incomingPhoneNumbers
    ->create(
        array(
            "friendlyName" => "My Company Line",
            "voiceUrl" => "http://demo.twilio.com/docs/voice.xml",
            "phoneNumber" => "+15105647903",
            "voiceMethod" => "GET"
        )
    );

echo $number->sid;
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

number = client.phone_numbers.purchase(friendly_name="My Company Line",
    voice_url="http://demo.twilio.com/docs/voice.xml",
    phone_number="+15105647903",
    voice_method="GET")
print(number.sid)
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'twilio-ruby'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

# Initialize Twilio Client
@client = Twilio::REST::Client.new(account_sid, auth_token)

@number = @client.account.incoming_phone_numbers
                 .create(
                   friendly_name: 'My Company Line',
                   voice_url: 'http://demo.twilio.com/docs/voice.xml',
                   phone_number: '+15105647903',
                   voice_method: 'GET'
                 )

puts @number.sms_url
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers.json \
    -d "FriendlyName=My%20Company%20Line" \
    -d "VoiceUrl=http://demo.twilio.com/docs/voice.xml" \
    -d "PhoneNumber=%2B15105647903" \
    -d "VoiceMethod=GET" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers \
    -d "FriendlyName=My%20Company%20Line" \
    -d "VoiceUrl=http://demo.twilio.com/docs/voice.xml" \
    -d "PhoneNumber=%2B15105647903" \
    -d "VoiceMethod=GET" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.factory.IncomingPhoneNumberFactory;
import com.twilio.sdk.resource.instance.IncomingPhoneNumber;
import com.twilio.sdk.resource.list.IncomingPhoneNumberList;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Build a filter for the IncomingPhoneNumberList
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    params.add(new BasicNameValuePair("FriendlyName", "My Company Line"));
    params.add(new BasicNameValuePair("VoiceUrl", "http://demo.twilio.com/docs/voice.xml"));
    params.add(new BasicNameValuePair("PhoneNumber", "+15105647903"));
    params.add(new BasicNameValuePair("VoiceMethod", "GET"));
    
    IncomingPhoneNumberFactory numberFactory = client.getAccount().getIncomingPhoneNumberFactory();
    IncomingPhoneNumber number = numberFactory.create(params);
    System.out.println(number.getSid());
  }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

number = client.incoming_phone_numbers \
               .create(friendly_name="My Company Line",
                       voice_url="http://demo.twilio.com/docs/voice.xml",
                       phone_number="+15105647903",
                       voice_method="GET")

print(number.sid)
// Download the Node helper library from twilio.com/docs/node/install
// These consts are your accountSid and authToken from https://www.twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);

client.incomingPhoneNumbers.create({
  friendlyName: 'My Company Line',
  voiceUrl: 'http://demo.twilio.com/docs/voice.xml',
  phoneNumber: '+15105647903',
  voiceMethod: 'GET',
})
.then((number) => console.log(number.sid));
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example 
{
  static void Main(string[] args) 
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    var options = new PhoneNumberOptions();
    options.FriendlyName = "My Company Line";
    options.VoiceUrl = "http://demo.twilio.com/docs/voice.xml";
    options.PhoneNumber = "+15105647903";
    options.VoiceMethod = "GET";
    var number = twilio.AddIncomingPhoneNumber(options);
    
    Console.WriteLine(number.Sid);
  }
}
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Services_Twilio($sid, $token);

$number = $client->account->incoming_phone_numbers->create(
    array(
        "FriendlyName" => "My Company Line",
        "VoiceUrl" => "http://demo.twilio.com/docs/voice.xml",
        "PhoneNumber" => "+15105647903",
        "VoiceMethod" => "GET"
    )
);
echo $number->sid;
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token

number = @client.account.incoming_phone_numbers
  .create(:friendly_name => "My Company Line",
          :voice_url => "http://demo.twilio.com/docs/voice.xml",
          :phone_number => "+15105647903",
          :voice_method => "GET")
puts number.sms_url
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.http.HttpMethod;
import com.twilio.rest.api.v2010.account.IncomingPhoneNumber;
import com.twilio.type.PhoneNumber;

public class Example {
  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    IncomingPhoneNumber number = IncomingPhoneNumber.creator(new PhoneNumber("+15105647903"))
        .setFriendlyName("My Company Line").setVoiceUrl("http://demo.twilio.com/docs/voice.xml")
        .setVoiceMethod(HttpMethod.GET).create();

    System.out.println(number.getSid());
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.incomingPhoneNumbers.create({
    friendlyName: "My Company Line",
    voiceUrl: "http://demo.twilio.com/docs/voice.xml",
    phoneNumber: "+15105647903",
    voiceMethod: "GET"
}, function(err, number) {
    console.log(number.sid);
});
{
  "sid": "PN2a0747eba6abf96b7e3c3ff0b4530f6e",
  "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "friendly_name": "My Company Line",
  "phone_number": "+15105647903",
  "voice_url": "http://demo.twilio.com/docs/voice.xml",
  "voice_method": "POST",
  "voice_fallback_url": null,
  "voice_fallback_method": "POST",
  "voice_caller_id_lookup": null,
  "voice_application_sid": null,
  "date_created": "Mon, 16 Aug 2010 23:31:47 +0000",
  "date_updated": "Mon, 16 Aug 2010 23:31:47 +0000",
  "sms_url": null,
  "sms_method": "POST",
  "sms_fallback_url": null,
  "sms_fallback_method": "GET",
  "sms_application_sid": null,
  "capabilities": {
    "voice": true,
    "sms": true
    "mms": false
  },
  "beta": false
  "status_callback": null,
  "status_callback_method": null,
  "api_version": "2010-04-01",
  "uri": "\/2010-04-01\/Accounts\/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\/IncomingPhoneNumbers\/PN2a0747eba6abf96b7e3c3ff0b4530f6e.json"
}
<TwilioResponse>
  <IncomingPhoneNumber>
    <Sid>PN2a0747eba6abf96b7e3c3ff0b4530f6e</Sid>
    <AccountSid>ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</AccountSid>
    <FriendlyName>My Company Line</FriendlyName>
    <PhoneNumber>+15105647903</PhoneNumber>
    <VoiceUrl>http://demo.twilio.com/docs/voice.xml</VoiceUrl>
    <VoiceMethod>GET</VoiceMethod>
    <VoiceFallbackUrl></VoiceFallbackUrl>
    <VoiceFallbackMethod>POST</VoiceFallbackMethod>
    <VoiceCallerIdLookup>false</VoiceCallerIdLookup>
    <VoiceApplicationSid/>
    <DateCreated>Mon, 16 Aug 2010 23:00:23 +0000</DateCreated>
    <DateUpdated>Mon, 16 Aug 2010 23:00:23 +0000</DateUpdated>
    <SmsUrl></SmsUrl>
    <SmsMethod>POST</SmsMethod>
    <SmsFallbackUrl></SmsFallbackUrl>
    <SmsFallbackMethod>GET</SmsFallbackMethod>
    <SmsApplicationSid/>
    <Capabilities>
      <Voice>true</Voice>
      <SMS>true</SMS>
      <MMS>false</MMS>
    </Capabilities>
    <Beta>false</Beta>
    <StatusCallback/>
    <StatusCallbackMethod/>
    <ApiVersion>2010-04-01</ApiVersion>
    <Uri>/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/IncomingPhoneNumbers/PN2a0747eba6abf96b7e3c3ff0b4530f6e</Uri>
  </IncomingPhoneNumber>
</TwilioResponse>