10000 Add phone number property update example · jlukanta/twilio-python@8cceda5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8cceda5

Browse files
author
Kevin Burke
committed
Add phone number property update example
Also move caller id validation to its own page
1 parent f14205c commit 8cceda5

File tree

2 files changed

+45
-17
lines changed

2 files changed

+45
-17
lines changed

docs/usage/caller-ids.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
Validate a Phone Number
3+
-----------------------
4+
5+
Validating a phone number is quick and easy.
6+
7+
.. code-block:: python
8+
9+
from twilio.rest import TwilioRestClient
10+
11+
# To find these visit https://www.twilio.com/user/account
12+
ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXX"
13+
AUTH_TOKEN = "YYYYYYYYYYYYYYYYYY"
14+
15+
client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN)
16+
response = client.caller_ids.validate("+44 9876543212")
17+
print response["validation_code"]
18+
19+
Twilio will call the provided number and wait for the validation code to be
20+
entered.
21+

docs/usage/phone-numbers.rst

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ to augment your search. The `AvailablePhoneNumbers REST Resource
6161
<http://www.twilio.com/docs/api/rest/available-phone-numbers>`_ documentation
6262
also documents the various search options.
6363

64-
6564
Buying a Number
6665
---------------
6766

@@ -78,45 +77,53 @@ If you've found a phone number you want, you can purchase the number.
7877
client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN)
7978
number = client.phone_numbers.purchase("+15305431234")
8079
81-
However, it's easier to purchase numbers after finding them using search (as shown in the first example).
82-
80+
However, it's easier to purchase numbers after finding them using search (as
81+
shown in the first example).
8382

84-
Changing Applications
85-
----------------------
83+
Updating Properties on a Number
84+
------------------
8685

87-
An :class:`Application` encapsulates all necessary URLs for use with phone numbers. Update an application on a phone number using :meth:`update`.
86+
To update the properties on a phone number, call :meth:`update`
87+
on the phone number object, with any of the parameters
88+
listed in the `IncomingPhoneNumbers Resource documentation
89+
<http://www.twilio.com/docs/api/rest/incoming-phone-numbers>`_
8890

8991
.. code-block:: python
9092
9193
from twilio.rest import TwilioRestClient
9294
93-
phone_sid = "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
94-
9595
# To find these visit https://www.twilio.com/user/account
9696
ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXX"
9797
AUTH_TOKEN = "YYYYYYYYYYYYYYYYYY"
9898
9999
client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN)
100-
number = client.phone_numbers.update(phone_sid, sms_application_sid="AP123")
100+
for number in client.phone_numbers.list(api_version="2010-04-01"):
101+
number.update(voice_url="http://twimlets.com/holdmusic?" +
102+
"Bucket=com.twilio.music.ambient",
103+
status_callback="http://example.com/callback")
101104
102-
See :doc:`/usage/applications` for instructions on updating and maintaining Applications.
105+
Changing Applications
106+
----------------------
103107

104-
Validate a Phone Number
105-
-----------------------
106-
Validating a phone number is quick and easy.
108+
An :class:`Application` encapsulates all necessary URLs for use with phone numbers. Update an application on a phone number using :meth:`update`.
107109

108110
.. code-block:: python
109111
110112
from twilio.rest import TwilioRestClient
111113
114+
phone_sid = "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
115+
112116
# To find these visit https://www.twilio.com/user/account
113117
ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXX"
114118
AUTH_TOKEN = "YYYYYYYYYYYYYYYYYY"
115119
116120
client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN)
117-
response = client.caller_ids.validate("+9876543212")
118-
print response["validation_code"]
121+
number = client.phone_numbers.update(phone_sid, sms_application_sid="AP123")
122+
123+
See :doc:`/usage/applications` for instructions on updating and maintaining Applications.
124+
125+
Validate a Phone Number
126+
-----------------------
119127

120-
Twilio will call the provided number and wait for the validation code to be
121-
entered.
128+
See validation instructions here: :doc:`/usage/caller-ids`:
122129

0 commit comments

Comments
 (0)
0