REST API: ショート コード

ショートコードは5-6桁(通常より短い)番号を持ち、携帯電話へメッセージ送信、携帯電話からの受信を行うことができます。大量に送る場合、メッセージ到着時間が厳格な場合に利用します。Twilioが保有するショートコードを購入することができます。(日本では未提供です)

ショートコードを使ってメッセージを送信したい場合は「メッセージを送る」ドキュメンを御覧ください。

ShortCode インスタンス リソース

リソース URI

/2010-04-01/Accounts/{AccountSid}/SMS/ShortCodes/{ShortCodeSid}

リソースのプロパティ

プロパティ 説明
Sid このリソースを一意に識別する 34 文字の文字列です。
DateCreated このリソースが生成された日付の GMT 表記です。 RFC 2822 フォーマットを使用します。
DateUpdated このリソースが最後に更新された日付の GMT 表記です。RFC 2822フォーマットを使用します。
FriendlyName このリソースの、人間が読みやすい形式の説明です。64 文字まで設定できます。 デフォルトでは、FriendlyNameはショート コードです。
AccountSid このショート コードを所有する アカウント のユニーク ID です。
ShortCode ショート コードです。 例: 894546
ApiVersion このショート コードへ SMS が送信されると、この API バージョンを使って新しい TwiML セッションを開始します。
SmsUrl このショート コードへの着信 SMS メッセージを受信した時に、Twilio がリクエストを送信する URL です。
SmsMethod SmsUrl へリクエストを送信する際に、Twilio が使用する HTTP のメソッドです。GET または POST のいずれかです。
SmsFallbackUrl SmsUrl から TwiML の取得または実行時にエラーが発生した場合、Twilio がリクエストを送信する URL です。
SmsFallbackMethod 上述の URL へリクエストを送信する際に、Twilio が使用する HTTP のメソッドです。GET または POST のいずれかです。
Uri このリソースの URI です。https://api.twilio.com からの相対パスです。

HTTP GET

ショートコードの取得
  • 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 shortCode = ShortCodeResource.Fetch("SC6b20cb705c1e8f00210049b20b70fce2");

        Console.WriteLine(shortCode.ShortCode);
    }
}
<?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
$shortCode = $client
    ->shortCodes("SC6b20cb705c1e8f00210049b20b70fce2")
    ->fetch();

echo $shortCode->shortCode;
# 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)

short_code = client.sms.short_codes.get("SC6b20cb705c1e8f00210049b20b70fce2")
print(short_code.short_code)
require 'rubygems' # not necessary with ruby 1.9 but included for completeness
require 'twilio-ruby'

# put your own credentials here
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

# set up a client to talk to the Twilio REST API
@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
@short_code = @client.account
                     .short_codes('SC6b20cb705c1e8f00210049b20b70fce2').fetch

puts @short_code.short_code
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes/SC6b20cb705c1e8f00210049b20b70fce2.json \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes/SC6b20cb705c1e8f00210049b20b70fce2 \
    -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.ShortCode;

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
    ShortCode shortCode = client.getAccount().getShortCode("SC6b20cb705c1e8f00210049b20b70fce2");
    System.out.println(shortCode.getShortCode());
    
  }
}
# 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)

short_code = client.short_codes("SC6b20cb705c1e8f00210049b20b70fce2") \
                   .fetch()

print(short_code.short_code)
// 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.shortCodes('SC6b20cb705c1e8f00210049b20b70fce2')
  .fetch()
  .then((shortCode) => console.log(shortCode.shortCode));
// 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 shortCode = twilio.GetShortCode("SC6b20cb705c1e8f00210049b20b70fce2");
    
    Console.WriteLine(shortCode.ShortCode);
  }
}
<?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
$short_code = $client->account->short_codes->get("SC6b20cb705c1e8f00210049b20b70fce2");
echo $short_code->short_code;
# 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
@short_code = @client.account.sms.short_codes.get("SC6b20cb705c1e8f00210049b20b70fce2")
puts @short_code.short_code
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.ShortCode;

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
    ShortCode shortCode = ShortCode.fetcher("SC6b20cb705c1e8f00210049b20b70fce2").fetch();

    System.out.println(shortCode.getShortCode());
  }
}
// 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.sms.shortCodes("SC6b20cb705c1e8f00210049b20b70fce2").get(function(err, shortCode) {
    console.log(shortCode.shortCode);
});
出力を表示
  • JSON
  • XML
{
	"sid": "SC6b20cb705c1e8f00210049b20b70fce2",
	"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
	"friendly_name": "67898",
	"short_code": "67898",
	"date_created": "Sat, 09 Jul 2011 22:36:22 +0000",
	"date_updated": "Sat, 09 Jul 2011 22:36:22 +0000",
	"sms_url": "http://demo.twilio.com/docs/sms.xml",
	"sms_method": "POST",
	"sms_fallback_url": "http://example.com/fallback",
	"sms_fallback_method": "GET",
	"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes/SC6b20cb705c1e8f00210049b20b70fce2.json"
}
<TwilioResponse>
  <ShortCode>
    <Sid>SC6b20cb705c1e8f00210049b20b70fce2</Sid>
    <AccountSid>ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</AccountSid>
    <FriendlyName>67898</FriendlyName>
    <ShortCode>67898</ShortCode>
    <DateCreated>Sat, 09 Jul 2011 22:36:22 +0000</DateCreated>
    <DateUpdated>Sat, 09 Jul 2011 22:36:22 +0000</DateUpdated>
    <SmsUrl>http://demo.twilio.com/docs/sms.xml</SmsUrl>
    <SmsMethod>POST</SmsMethod>
    <SmsFallbackUrl>http://smsapp.com/fallback</SmsFallbackUrl>
    <SmsFallbackMethod>GET</SmsFallbackMethod>
    <Uri>/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes/SC6b20cb705c1e8f00210049b20b70fce2</Uri>
  </ShortCode>
</TwilioResponse>
ショートコードの取得

HTTP POST

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

オプションパラメーター

次のパラメーターの 1 つまたは複数を指定して、このショート コードのプロパティを更新できます。

パラメーター 説明
FriendlyName このショート コードの、人間が読みやすい形式の説明です。64 文字まで設定できます。
ApiVersion このショート コードへ SMS が送信されると、この API バージョンを使って新しい TwiML セッションを開始します。 2010-04-01 または 2008-08-01のいずれかです。
SmsUrl このショート コード宛てに SMS が送信された時に、Twilio がリクエストを送信する URL です。
SmsMethod SmsUrl へリクエストを送信する際に、Twilio が使用する HTTP のメソッドです。GET または POST のいずれかです。
SmsFallbackUrl SmsUrl の TwiML のリクエストまたは実行時にエラーが発生した場合、Twilio がリクエストを送信する URL です。
SmsFallbackMethod SmsFallbackUrl へリクエストを送信する際に、Twilio が使用する HTTP のメソッドです。GET または POST のいずれかです。
例 1

ショート コードのSmsUrl を http://myapp.com/awesome に設定します。

ショートコードのパラメーターの変更
  • 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);

        ShortCodeResource.Update("SC6b20cb705c1e8f00210049b20b70fce3", 
                                 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
$shortCode = $client
    ->shortCodes("SC6b20cb705c1e8f00210049b20b70fce2")
    ->update(
        array("smsUrl" => "http://demo.twilio.com/docs/sms.xml")
    );

echo $shortCode->shortCode;
# 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)

short_code = client.sms.short_codes.update("SC6b20cb705c1e8f00210049b20b70fce3", sms_url="http://demo.twilio.com/docs/sms.xml")
print(short_code.short_code)
require 'rubygems' # not necessary with ruby 1.9 but included for completeness
require 'twilio-ruby'

# put your own credentials here
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

# set up a client to talk to the Twilio REST API
@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
@short_code = @client.account
                     .short_codes('SC6b20cb705c1e8f00210049b20b70fce3')
                     .fetch

@short_code.update(sms_url: 'http://demo.twilio.com/docs/sms.xml')

puts @short_code.short_code
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes/SC6b20cb705c1e8f00210049b20b70fce3.json \
    -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/SMS/ShortCodes/SC6b20cb705c1e8f00210049b20b70fce3 \
    -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.ShortCode;
import com.twilio.sdk.resource.list.ShortCodeList;
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
    ShortCode shortCode = client.getAccount().getShortCode("SC6b20cb705c1e8f00210049b20b70fce3");
    // Build a filter for the ShortCodeList
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    params.add(new BasicNameValuePair("SmsUrl", "http://demo.twilio.com/docs/sms.xml"));
    shortCode.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)

short_code = client.short_codes("SC6b20cb705c1e8f00210049b20b70fce3") \
                   .update(sms_url="http://demo.twilio.com/docs/sms.xml")

print(short_code.short_code)
// 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.shortCodes('SC6b20cb705c1e8f00210049b20b70fce3')
  .update({smsUrl: 'http://demo.twilio.com/docs/sms.xml'})
  .then((shortCode) => console.log(shortCode.shortCode));
// 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);
 
    twilio.UpdateShortCode("SC6b20cb705c1e8f00210049b20b70fce3", null, null, "http://demo.twilio.com/docs/sms.xml", null, null, null);
  }
}
<?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
$short_code = $client->account->short_codes->get("SC6b20cb705c1e8f00210049b20b70fce3");
$short_code->update(array(
        "SmsUrl" => "http://demo.twilio.com/docs/sms.xml"
    ));
echo $short_code->short_code;
# 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
@short_code = @client.account.sms.short_codes.get("SC6b20cb705c1e8f00210049b20b70fce3")
@short_code.update(:sms_url => "http://demo.twilio.com/docs/sms.xml")
puts @short_code.short_code
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.ShortCode;

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
    ShortCode shortCode = ShortCode.updater("SC6b20cb705c1e8f00210049b20b70fce3")
        .setSmsUrl("http://demo.twilio.com/docs/sms.xml")
        .update();
  }
}
// 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.sms.shortCodes("SC6b20cb705c1e8f00210049b20b70fce3").update({
    smsUrl: "http://demo.twilio.com/docs/sms.xml"
}, function(err, shortCode) {
    console.log(shortCode.shortCode);
});
出力を表示
  • JSON
  • XML
{
	"sid": "SC6b20cb705c1e8f00210049b20b70fce2",
	"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
	"friendly_name": "67898",
	"short_code": "67898",
	"date_created": "Sat, 09 Jul 2011 22:36:22 +0000",
	"date_updated": "Wed, 13 Jul 2011 02:07:05 +0000",
	"sms_url": "http://demo.twilio.com/docs/sms.xml",
	"sms_method": "POST",
	"sms_fallback_url": "http://smsapp.com/fallback",
	"sms_fallback_method": "GET",
	"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes/SC6b20cb705c1e8f00210049b20b70fce2.json"
}
<TwilioResponse>
  <ShortCode>
    <Sid>SC6b20cb705c1e8f00210049b20b70fce2</Sid>
    <AccountSid>ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</AccountSid>
    <FriendlyName>67898</FriendlyName>
    <ShortCode>67898</ShortCode>
    <DateCreated>Sat, 09 Jul 2011 22:36:22 +0000</DateCreated>
    <DateUpdated>Wed, 13 Jul 2011 02:07:05 +0000</DateUpdated>
    <SmsUrl>http://myapp.com/awesome</SmsUrl>
    <SmsMethod>POST</SmsMethod>
    <SmsFallbackUrl>http://smsapp.com/fallback</SmsFallbackUrl>
    <SmsFallbackMethod>GET</SmsFallbackMethod>
    <Uri>/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes/SC6b20cb705c1e8f00210049b20b70fce2</Uri>
  </ShortCode>
</TwilioResponse>
ショートコードのパラメーターの変更

HTTP PUT

サポートしません。

HTTP DELETE

サポートしません。

ShortCodes リスト リソース

リソース URI

/2010-04-01/Accounts/{AccountSid}/SMS/ShortCodes

HTTP GET

ShortCode リソース表現のリストを返します。各項目は、アカウント内のショート コードを表現します。 このリストは ページ情報を含みます。

リスト フィルター

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

パラメーター 説明
ShortCode このパターンに一致する ShortCode リソースのみを返します。 番号の一部を指定し、「*」を任意の 1 桁のワイルドカードとして使用することができます。
FriendlyName この名前と FriendlyName が一致する ShortCode リソースのみを返します。
例 1
すべてのショートコードのリストの取得
  • 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 shortCodes = ShortCodeResource.Read();

        foreach (var shortCode in shortCodes)
        {
            Console.WriteLine(shortCode.ShortCode);
        }
    }
}
<?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 short_codes and echo a property for each one
foreach ($client->shortCodes->read() as $shortCode) {
    echo $shortCode->shortCode;
}
# 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 short_code objects with the properties described above
short_codes = client.sms.short_codes.list()
require 'rubygems' # not necessary with ruby 1.9 but included for completeness
require 'twilio-ruby'

# put your own credentials here
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

# set up a client to talk to the Twilio REST API
@client = Twilio::REST::Client.new(account_sid, auth_token)

# Loop over short_codes and print out a property for each one
@client.account.short_codes.list.each do |short_code|
  puts short_code.short_code
end
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes.json \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes \
    -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.ShortCode;
import com.twilio.sdk.resource.list.ShortCodeList;

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);

    
    
    ShortCodeList shortCodes = client.getAccount().getShortCodes();
    
    // Loop over shortCodes and print out a property for each one.
    for (ShortCode shortCode : shortCodes) {
      System.out.println(shortCode.getShortCode());
    }
    
  }
}
# 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 short_code objects with the properties described above
for short_code in client.short_codes.list():
    print(short_code.short_code)
// 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.shortCodes
  .each((shortCode) => console.log(shortCode.shortCode));
// 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 shortCodes = twilio.ListShortCodes(null, null);
    
    foreach (var shortCode in shortCodes.ShortCodes)
    {
      Console.WriteLine(shortCode.ShortCode);
    }
  }
}
<?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 short_codes and echo a property for each one
foreach ($client->account->short_codes as $short_code) {
    echo $short_code->short_code;
}
# 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 short_codes and print out a property for each one
@client.account.sms.short_codes.list.each do |short_code|
  puts short_code.short_code
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.ShortCode;

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<ShortCode> shortCodes = ShortCode.reader().read();

    // Loop over shortCodes and print out a property for each one.
    for (ShortCode shortCode : shortCodes) {
      System.out.println(shortCode.getShortCode());
    }
  }
}
// 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.sms.shortCodes.list(function(err, data) {
    data.shortCodes.forEach(function(shortCode) {
        console.log(shortCode.ShortCode);
    });
});
出力を表示
  • JSON
  • XML
{
	"page": 0,
	"page_size": 50,
	"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes.json",
	"first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes.json?Page=0&PageSize=50",
	"previous_page_uri": null,
	"next_page_uri": null,
	"short_codes": [
	    {
			"sid": "SC6b20cb705c1e8f00210049b20b70fce2",
			"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
			"friendly_name": "67898",
			"short_code": "67898",
			"date_created": "Sat, 09 Jul 2011 22:36:22 +0000",
			"date_updated": "Wed, 13 Jul 2011 02:07:05 +0000",
			"sms_url": "http://demo.twilio.com/docs/sms.xml",
			"sms_method": "POST",
			"sms_fallback_url": "http://smsapp.com/fallback",
			"sms_fallback_method": "GET",
			"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes/SC6b20cb705c1e8f00210049b20b70fce2.json"
		},
		...
	]
}
<TwilioResponse>
  <ShortCodes page="0" pagesize="50" uri="/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes" firstpageuri="/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes?Page=0&amp;PageSize=50" previouspageuri="" nextpageuri="">
    <ShortCode>
      <Sid>SC6b20cb705c1e8f00210049b20b70fce2</Sid>
      <AccountSid>ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</AccountSid>
      <FriendlyName>67898</FriendlyName>
      <ShortCode>67898</ShortCode>
      <DateCreated>Sat, 09 Jul 2011 22:36:22 +0000</DateCreated>
      <DateUpdated>Wed, 13 Jul 2011 02:07:05 +0000</DateUpdated>
      <SmsUrl>http://demo.twilio.com/docs/sms.xml</SmsUrl>
      <SmsMethod>POST</SmsMethod>
      <SmsFallbackUrl>http://smsapp.com/fallback</SmsFallbackUrl>
      <SmsFallbackMethod>GET</SmsFallbackMethod>
      <Uri>/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes/SC6b20cb705c1e8f00210049b20b70fce2</Uri>
    </ShortCode>
	...
  </ShortCodes>
</TwilioResponse>
すべてのショートコードのリストの取得
例 2

67898 に完全に一致するショート コードのセットを返します。

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 shortCodes = ShortCodeResource.Read(shortCode: "67898");

        foreach (var shortCode in shortCodes)
        {
            Console.WriteLine(shortCode.SmsMethod);
        }
    }
}
<?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);

$shortCodes = $client->shortCodes->read(
    array("shortCode" => "67898")
);

// Loop over the list of shortCodes and echo a property for each one
foreach ($shortCodes as $shortCode) {
    echo $shortCode->smsMethod;
}
# 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 short_code objects with the properties described above
short_codes = client.sms.short_codes.list(short_code="67898")
require 'rubygems' # not necessary with ruby 1.9 but included for completeness
require 'twilio-ruby'

# put your own credentials here
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

# set up a client to talk to the Twilio REST API
@client = Twilio::REST::Client.new(account_sid, auth_token)

# Loop over short_codes and print out a property for each one
@client.account.short_codes.list(
  short_code: '67898'
).each do |short_code|
  puts short_code.sms_method
end
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes.json \
    -d "ShortCode=67898" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes \
    -d "ShortCode=67898" \
    -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.ShortCode;
import com.twilio.sdk.resource.list.ShortCodeList;
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 ShortCodeList
    Map<String, String> params = new HashMap<String, String>();
    
    params.put("ShortCode", "67898");
    
    ShortCodeList shortCodes = client.getAccount().getShortCodes(params);
    
    // Loop over shortCodes and print out a property for each one.
    for (ShortCode shortCode : shortCodes) {
      System.out.println(shortCode.getSmsMethod());
    }
    
  }
}
# 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 short_code objects with the properties described above
short_codes = client.short_codes \
                    .list(short_code="67898")

for short_code in short_codes:
    print(short_code.sms_method)
// 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.shortCodes.each({shortCode: '67898'},
                       (shortCode) => console.log(shortCode.smsMethod));
// 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 shortCodes = twilio.ListShortCodes("67898", null);
    
    foreach (var shortCode in shortCodes.ShortCodes)
    {
      Console.WriteLine(shortCode.SmsMethod);
    }
  }
}
<?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 short_codes and echo a property for each one
foreach ($client->account->short_codes->getIterator(0, 50, array(
        "ShortCode" => "67898"
    )) as $short_code
) {
    echo $short_code->sms_method;
}
# 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 short_codes and print out a property for each one
@client.account.sms.short_codes.list({
  :short_code => "67898"}).each do |short_code|
  puts short_code.sms_method
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.ShortCode;

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<ShortCode> shortCodes = ShortCode.reader()
        .setShortCode("67898")
        .read();

    // Loop over shortCodes and print out a property for each one.
    for (ShortCode shortCode : shortCodes) {
      System.out.println(shortCode.getShortCode());
    }
  }
}
// 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.sms.shortCodes.list({ shortCode: "67898" }, function(err, data) {
    data.shortCodes.forEach(function(shortCode) {
        console.log(shortCode.SmsMethod);
    });
});
完全一致によるショートコードのフィルタリング
例 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;

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 shortCodes = ShortCodeResource.Read(shortCode: "898");

        foreach (var shortCode in shortCodes)
        {
            Console.WriteLine(shortCode.SmsMethod);
        }
    }
}
<?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);

$shortCodes = $client->shortCodes->read(
    array("shortCode" => "898")
);

// Loop over the list of short_codes and echo a property for each one
foreach ($shortCodes as $shortCode) {
    echo $shortCode->smsMethod;
}
# 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 short_code objects with the properties described above
short_codes = client.sms.short_codes.list(short_code="898")
require 'rubygems' # not necessary with ruby 1.9 but included for completeness
require 'twilio-ruby'

# put your own credentials here
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

# set up a client to talk to the Twilio REST API
@client = Twilio::REST::Client.new(account_sid, auth_token)

# Loop over short_codes and print out a property for each one
@client.account.short_codes.list(
  short_code: '898'
).each do |short_code|
  puts short_code.sms_method
end
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes.json \
    -d "ShortCode=898" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes \
    -d "ShortCode=898" \
    -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.ShortCode;
import com.twilio.sdk.resource.list.ShortCodeList;
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 ShortCodeList
    Map<String, String> params = new HashMap<String, String>();
    
    params.put("ShortCode", "898");
    
    ShortCodeList shortCodes = client.getAccount().getShortCodes(params);
    
    // Loop over shortCodes and print out a property for each one.
    for (ShortCode shortCode : shortCodes) {
      System.out.println(shortCode.getSmsMethod());
    }
    
  }
}
# 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 short_code objects with the properties described above
short_codes = client.short_codes \
                    .list(short_code="898")

for short_code in short_codes:
    print(short_code.sms_method)
// 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.shortCodes.each({shortCode: '898'},
                       (shortCode) => console.log(shortCode.smsMethod));
// 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 shortCodes = twilio.ListShortCodes("898", null);
    
    foreach (var shortCode in shortCodes.ShortCodes)
    {
      Console.WriteLine(shortCode.SmsMethod);
    }
  }
}
<?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 short_codes and echo a property for each one
foreach ($client->account->short_codes->getIterator(0, 50, array(
        "ShortCode" => "898"
    )) as $short_code
) {
    echo $short_code->sms_method;
}
# 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 short_codes and print out a property for each one
@client.account.sms.short_codes.list({
  :short_code => "898"}).each do |short_code|
  puts short_code.sms_method
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.ShortCode;

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<ShortCode> shortCodes = ShortCode.reader()
        .setShortCode("898")
        .read();

    // Loop over shortCodes and print out a property for each one.
    for (ShortCode shortCode : shortCodes) {
      System.out.println(shortCode.getSmsMethod());
    }
  }
}
// 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.sms.shortCodes.list({ shortCode: "898" }, function(err, data) {
    data.shortCodes.forEach(function(shortCode) {
        console.log(shortCode.SmsMethod);
    });
});
部分一致によるショートコードのフィルタリング

HTTP POST

サポートしません。

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 shortCode = ShortCodeResource.Fetch("SC6b20cb705c1e8f00210049b20b70fce2");

        Console.WriteLine(shortCode.ShortCode);
    }
}
<?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
$shortCode = $client
    ->shortCodes("SC6b20cb705c1e8f00210049b20b70fce2")
    ->fetch();

echo $shortCode->shortCode;
# 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)

short_code = client.sms.short_codes.get("SC6b20cb705c1e8f00210049b20b70fce2")
print(short_code.short_code)
require 'rubygems' # not necessary with ruby 1.9 but included for completeness
require 'twilio-ruby'

# put your own credentials here
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

# set up a client to talk to the Twilio REST API
@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
@short_code = @client.account
                     .short_codes('SC6b20cb705c1e8f00210049b20b70fce2').fetch

puts @short_code.short_code
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes/SC6b20cb705c1e8f00210049b20b70fce2.json \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes/SC6b20cb705c1e8f00210049b20b70fce2 \
    -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.ShortCode;

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
    ShortCode shortCode = client.getAccount().getShortCode("SC6b20cb705c1e8f00210049b20b70fce2");
    System.out.println(shortCode.getShortCode());
    
  }
}
# 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)

short_code = client.short_codes("SC6b20cb705c1e8f00210049b20b70fce2") \
                   .fetch()

print(short_code.short_code)
// 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.shortCodes('SC6b20cb705c1e8f00210049b20b70fce2')
  .fetch()
  .then((shortCode) => console.log(shortCode.shortCode));
// 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 shortCode = twilio.GetShortCode("SC6b20cb705c1e8f00210049b20b70fce2");
    
    Console.WriteLine(shortCode.ShortCode);
  }
}
<?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
$short_code = $client->account->short_codes->get("SC6b20cb705c1e8f00210049b20b70fce2");
echo $short_code->short_code;
# 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
@short_code = @client.account.sms.short_codes.get("SC6b20cb705c1e8f00210049b20b70fce2")
puts @short_code.short_code
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.ShortCode;

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
    ShortCode shortCode = ShortCode.fetcher("SC6b20cb705c1e8f00210049b20b70fce2").fetch();

    System.out.println(shortCode.getShortCode());
  }
}
// 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.sms.shortCodes("SC6b20cb705c1e8f00210049b20b70fce2").get(function(err, shortCode) {
    console.log(shortCode.shortCode);
});
{
	"sid": "SC6b20cb705c1e8f00210049b20b70fce2",
	"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
	"friendly_name": "67898",
	"short_code": "67898",
	"date_created": "Sat, 09 Jul 2011 22:36:22 +0000",
	"date_updated": "Sat, 09 Jul 2011 22:36:22 +0000",
	"sms_url": "http://demo.twilio.com/docs/sms.xml",
	"sms_method": "POST",
	"sms_fallback_url": "http://example.com/fallback",
	"sms_fallback_method": "GET",
	"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes/SC6b20cb705c1e8f00210049b20b70fce2.json"
}
<TwilioResponse>
  <ShortCode>
    <Sid>SC6b20cb705c1e8f00210049b20b70fce2</Sid>
    <AccountSid>ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</AccountSid>
    <FriendlyName>67898</FriendlyName>
    <ShortCode>67898</ShortCode>
    <DateCreated>Sat, 09 Jul 2011 22:36:22 +0000</DateCreated>
    <DateUpdated>Sat, 09 Jul 2011 22:36:22 +0000</DateUpdated>
    <SmsUrl>http://demo.twilio.com/docs/sms.xml</SmsUrl>
    <SmsMethod>POST</SmsMethod>
    <SmsFallbackUrl>http://smsapp.com/fallback</SmsFallbackUrl>
    <SmsFallbackMethod>GET</SmsFallbackMethod>
    <Uri>/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes/SC6b20cb705c1e8f00210049b20b70fce2</Uri>
  </ShortCode>
</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);

        ShortCodeResource.Update("SC6b20cb705c1e8f00210049b20b70fce3", 
                                 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
$shortCode = $client
    ->shortCodes("SC6b20cb705c1e8f00210049b20b70fce2")
    ->update(
        array("smsUrl" => "http://demo.twilio.com/docs/sms.xml")
    );

echo $shortCode->shortCode;
# 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)

short_code = client.sms.short_codes.update("SC6b20cb705c1e8f00210049b20b70fce3", sms_url="http://demo.twilio.com/docs/sms.xml")
print(short_code.short_code)
require 'rubygems' # not necessary with ruby 1.9 but included for completeness
require 'twilio-ruby'

# put your own credentials here
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

# set up a client to talk to the Twilio REST API
@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
@short_code = @client.account
                     .short_codes('SC6b20cb705c1e8f00210049b20b70fce3')
                     .fetch

@short_code.update(sms_url: 'http://demo.twilio.com/docs/sms.xml')

puts @short_code.short_code
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes/SC6b20cb705c1e8f00210049b20b70fce3.json \
    -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/SMS/ShortCodes/SC6b20cb705c1e8f00210049b20b70fce3 \
    -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.ShortCode;
import com.twilio.sdk.resource.list.ShortCodeList;
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
    ShortCode shortCode = client.getAccount().getShortCode("SC6b20cb705c1e8f00210049b20b70fce3");
    // Build a filter for the ShortCodeList
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    params.add(new BasicNameValuePair("SmsUrl", "http://demo.twilio.com/docs/sms.xml"));
    shortCode.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)

short_code = client.short_codes("SC6b20cb705c1e8f00210049b20b70fce3") \
                   .update(sms_url="http://demo.twilio.com/docs/sms.xml")

print(short_code.short_code)
// 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.shortCodes('SC6b20cb705c1e8f00210049b20b70fce3')
  .update({smsUrl: 'http://demo.twilio.com/docs/sms.xml'})
  .then((shortCode) => console.log(shortCode.shortCode));
// 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);
 
    twilio.UpdateShortCode("SC6b20cb705c1e8f00210049b20b70fce3", null, null, "http://demo.twilio.com/docs/sms.xml", null, null, null);
  }
}
<?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
$short_code = $client->account->short_codes->get("SC6b20cb705c1e8f00210049b20b70fce3");
$short_code->update(array(
        "SmsUrl" => "http://demo.twilio.com/docs/sms.xml"
    ));
echo $short_code->short_code;
# 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
@short_code = @client.account.sms.short_codes.get("SC6b20cb705c1e8f00210049b20b70fce3")
@short_code.update(:sms_url => "http://demo.twilio.com/docs/sms.xml")
puts @short_code.short_code
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.ShortCode;

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
    ShortCode shortCode = ShortCode.updater("SC6b20cb705c1e8f00210049b20b70fce3")
        .setSmsUrl("http://demo.twilio.com/docs/sms.xml")
        .update();
  }
}
// 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.sms.shortCodes("SC6b20cb705c1e8f00210049b20b70fce3").update({
    smsUrl: "http://demo.twilio.com/docs/sms.xml"
}, function(err, shortCode) {
    console.log(shortCode.shortCode);
});
{
	"sid": "SC6b20cb705c1e8f00210049b20b70fce2",
	"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
	"friendly_name": "67898",
	"short_code": "67898",
	"date_created": "Sat, 09 Jul 2011 22:36:22 +0000",
	"date_updated": "Wed, 13 Jul 2011 02:07:05 +0000",
	"sms_url": "http://demo.twilio.com/docs/sms.xml",
	"sms_method": "POST",
	"sms_fallback_url": "http://smsapp.com/fallback",
	"sms_fallback_method": "GET",
	"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes/SC6b20cb705c1e8f00210049b20b70fce2.json"
}
<TwilioResponse>
  <ShortCode>
    <Sid>SC6b20cb705c1e8f00210049b20b70fce2</Sid>
    <AccountSid>ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</AccountSid>
    <FriendlyName>67898</FriendlyName>
    <ShortCode>67898</ShortCode>
    <DateCreated>Sat, 09 Jul 2011 22:36:22 +0000</DateCreated>
    <DateUpdated>Wed, 13 Jul 2011 02:07:05 +0000</DateUpdated>
    <SmsUrl>http://myapp.com/awesome</SmsUrl>
    <SmsMethod>POST</SmsMethod>
    <SmsFallbackUrl>http://smsapp.com/fallback</SmsFallbackUrl>
    <SmsFallbackMethod>GET</SmsFallbackMethod>
    <Uri>/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes/SC6b20cb705c1e8f00210049b20b70fce2</Uri>
  </ShortCode>
</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 shortCodes = ShortCodeResource.Read();

        foreach (var shortCode in shortCodes)
        {
            Console.WriteLine(shortCode.ShortCode);
        }
    }
}
<?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 short_codes and echo a property for each one
foreach ($client->shortCodes->read() as $shortCode) {
    echo $shortCode->shortCode;
}
# 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 short_code objects with the properties described above
short_codes = client.sms.short_codes.list()
require 'rubygems' # not necessary with ruby 1.9 but included for completeness
require 'twilio-ruby'

# put your own credentials here
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

# set up a client to talk to the Twilio REST API
@client = Twilio::REST::Client.new(account_sid, auth_token)

# Loop over short_codes and print out a property for each one
@client.account.short_codes.list.each do |short_code|
  puts short_code.short_code
end
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes.json \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes \
    -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.ShortCode;
import com.twilio.sdk.resource.list.ShortCodeList;

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);

    
    
    ShortCodeList shortCodes = client.getAccount().getShortCodes();
    
    // Loop over shortCodes and print out a property for each one.
    for (ShortCode shortCode : shortCodes) {
      System.out.println(shortCode.getShortCode());
    }
    
  }
}
# 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 short_code objects with the properties described above
for short_code in client.short_codes.list():
    print(short_code.short_code)
// 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.shortCodes
  .each((shortCode) => console.log(shortCode.shortCode));
// 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 shortCodes = twilio.ListShortCodes(null, null);
    
    foreach (var shortCode in shortCodes.ShortCodes)
    {
      Console.WriteLine(shortCode.ShortCode);
    }
  }
}
<?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 short_codes and echo a property for each one
foreach ($client->account->short_codes as $short_code) {
    echo $short_code->short_code;
}
# 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 short_codes and print out a property for each one
@client.account.sms.short_codes.list.each do |short_code|
  puts short_code.short_code
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.ShortCode;

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<ShortCode> shortCodes = ShortCode.reader().read();

    // Loop over shortCodes and print out a property for each one.
    for (ShortCode shortCode : shortCodes) {
      System.out.println(shortCode.getShortCode());
    }
  }
}
// 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.sms.shortCodes.list(function(err, data) {
    data.shortCodes.forEach(function(shortCode) {
        console.log(shortCode.ShortCode);
    });
});
{
	"page": 0,
	"page_size": 50,
	"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes.json",
	"first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes.json?Page=0&PageSize=50",
	"previous_page_uri": null,
	"next_page_uri": null,
	"short_codes": [
	    {
			"sid": "SC6b20cb705c1e8f00210049b20b70fce2",
			"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
			"friendly_name": "67898",
			"short_code": "67898",
			"date_created": "Sat, 09 Jul 2011 22:36:22 +0000",
			"date_updated": "Wed, 13 Jul 2011 02:07:05 +0000",
			"sms_url": "http://demo.twilio.com/docs/sms.xml",
			"sms_method": "POST",
			"sms_fallback_url": "http://smsapp.com/fallback",
			"sms_fallback_method": "GET",
			"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes/SC6b20cb705c1e8f00210049b20b70fce2.json"
		},
		...
	]
}
<TwilioResponse>
  <ShortCodes page="0" pagesize="50" uri="/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes" firstpageuri="/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes?Page=0&amp;PageSize=50" previouspageuri="" nextpageuri="">
    <ShortCode>
      <Sid>SC6b20cb705c1e8f00210049b20b70fce2</Sid>
      <AccountSid>ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</AccountSid>
      <FriendlyName>67898</FriendlyName>
      <ShortCode>67898</ShortCode>
      <DateCreated>Sat, 09 Jul 2011 22:36:22 +0000</DateCreated>
      <DateUpdated>Wed, 13 Jul 2011 02:07:05 +0000</DateUpdated>
      <SmsUrl>http://demo.twilio.com/docs/sms.xml</SmsUrl>
      <SmsMethod>POST</SmsMethod>
      <SmsFallbackUrl>http://smsapp.com/fallback</SmsFallbackUrl>
      <SmsFallbackMethod>GET</SmsFallbackMethod>
      <Uri>/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes/SC6b20cb705c1e8f00210049b20b70fce2</Uri>
    </ShortCode>
	...
  </ShortCodes>
</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
// 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 shortCodes = ShortCodeResource.Read(shortCode: "67898");

        foreach (var shortCode in shortCodes)
        {
            Console.WriteLine(shortCode.SmsMethod);
        }
    }
}
<?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);

$shortCodes = $client->shortCodes->read(
    array("shortCode" => "67898")
);

// Loop over the list of shortCodes and echo a property for each one
foreach ($shortCodes as $shortCode) {
    echo $shortCode->smsMethod;
}
# 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 short_code objects with the properties described above
short_codes = client.sms.short_codes.list(short_code="67898")
require 'rubygems' # not necessary with ruby 1.9 but included for completeness
require 'twilio-ruby'

# put your own credentials here
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

# set up a client to talk to the Twilio REST API
@client = Twilio::REST::Client.new(account_sid, auth_token)

# Loop over short_codes and print out a property for each one
@client.account.short_codes.list(
  short_code: '67898'
).each do |short_code|
  puts short_code.sms_method
end
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes.json \
    -d "ShortCode=67898" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes \
    -d "ShortCode=67898" \
    -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.ShortCode;
import com.twilio.sdk.resource.list.ShortCodeList;
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 ShortCodeList
    Map<String, String> params = new HashMap<String, String>();
    
    params.put("ShortCode", "67898");
    
    ShortCodeList shortCodes = client.getAccount().getShortCodes(params);
    
    // Loop over shortCodes and print out a property for each one.
    for (ShortCode shortCode : shortCodes) {
      System.out.println(shortCode.getSmsMethod());
    }
    
  }
}
# 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 short_code objects with the properties described above
short_codes = client.short_codes \
                    .list(short_code="67898")

for short_code in short_codes:
    print(short_code.sms_method)
// 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.shortCodes.each({shortCode: '67898'},
                       (shortCode) => console.log(shortCode.smsMethod));
// 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 shortCodes = twilio.ListShortCodes("67898", null);
    
    foreach (var shortCode in shortCodes.ShortCodes)
    {
      Console.WriteLine(shortCode.SmsMethod);
    }
  }
}
<?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 short_codes and echo a property for each one
foreach ($client->account->short_codes->getIterator(0, 50, array(
        "ShortCode" => "67898"
    )) as $short_code
) {
    echo $short_code->sms_method;
}
# 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 short_codes and print out a property for each one
@client.account.sms.short_codes.list({
  :short_code => "67898"}).each do |short_code|
  puts short_code.sms_method
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.ShortCode;

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<ShortCode> shortCodes = ShortCode.reader()
        .setShortCode("67898")
        .read();

    // Loop over shortCodes and print out a property for each one.
    for (ShortCode shortCode : shortCodes) {
      System.out.println(shortCode.getShortCode());
    }
  }
}
// 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.sms.shortCodes.list({ shortCode: "67898" }, function(err, data) {
    data.shortCodes.forEach(function(shortCode) {
        console.log(shortCode.SmsMethod);
    });
});
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 shortCodes = ShortCodeResource.Read(shortCode: "898");

        foreach (var shortCode in shortCodes)
        {
            Console.WriteLine(shortCode.SmsMethod);
        }
    }
}
<?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);

$shortCodes = $client->shortCodes->read(
    array("shortCode" => "898")
);

// Loop over the list of short_codes and echo a property for each one
foreach ($shortCodes as $shortCode) {
    echo $shortCode->smsMethod;
}
# 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 short_code objects with the properties described above
short_codes = client.sms.short_codes.list(short_code="898")
require 'rubygems' # not necessary with ruby 1.9 but included for completeness
require 'twilio-ruby'

# put your own credentials here
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

# set up a client to talk to the Twilio REST API
@client = Twilio::REST::Client.new(account_sid, auth_token)

# Loop over short_codes and print out a property for each one
@client.account.short_codes.list(
  short_code: '898'
).each do |short_code|
  puts short_code.sms_method
end
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes.json \
    -d "ShortCode=898" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/SMS/ShortCodes \
    -d "ShortCode=898" \
    -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.ShortCode;
import com.twilio.sdk.resource.list.ShortCodeList;
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 ShortCodeList
    Map<String, String> params = new HashMap<String, String>();
    
    params.put("ShortCode", "898");
    
    ShortCodeList shortCodes = client.getAccount().getShortCodes(params);
    
    // Loop over shortCodes and print out a property for each one.
    for (ShortCode shortCode : shortCodes) {
      System.out.println(shortCode.getSmsMethod());
    }
    
  }
}
# 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 short_code objects with the properties described above
short_codes = client.short_codes \
                    .list(short_code="898")

for short_code in short_codes:
    print(short_code.sms_method)
// 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.shortCodes.each({shortCode: '898'},
                       (shortCode) => console.log(shortCode.smsMethod));
// 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 shortCodes = twilio.ListShortCodes("898", null);
    
    foreach (var shortCode in shortCodes.ShortCodes)
    {
      Console.WriteLine(shortCode.SmsMethod);
    }
  }
}
<?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 short_codes and echo a property for each one
foreach ($client->account->short_codes->getIterator(0, 50, array(
        "ShortCode" => "898"
    )) as $short_code
) {
    echo $short_code->sms_method;
}
# 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 short_codes and print out a property for each one
@client.account.sms.short_codes.list({
  :short_code => "898"}).each do |short_code|
  puts short_code.sms_method
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.ShortCode;

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<ShortCode> shortCodes = ShortCode.reader()
        .setShortCode("898")
        .read();

    // Loop over shortCodes and print out a property for each one.
    for (ShortCode shortCode : shortCodes) {
      System.out.println(shortCode.getSmsMethod());
    }
  }
}
// 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.sms.shortCodes.list({ shortCode: "898" }, function(err, data) {
    data.shortCodes.forEach(function(shortCode) {
        console.log(shortCode.SmsMethod);
    });
});