forked from twilio/twilio-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
list-get-example-2.java
31 lines (23 loc) · 1.12 KB
/
list-get-example-2.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// 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.OutgoingCallerId;
import com.twilio.sdk.resource.list.OutgoingCallerIdList;
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 = "AC228ba32a3c49700934481addd5ce1659";
public static final String AUTH_TOKEN = "{{ auth_token }}";
public static void main(String[] args) throws TwilioRestException {
TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);
// Build a filter for the OutgoingCallerIdList
Map<String, String> params = new HashMap<String, String>();
params.put("PhoneNumber", "+14158675309");
OutgoingCallerIdList callerIds = client.getAccount().getOutgoingCallerIds(params);
// Loop over callerIds and print out a property for each one.
for (OutgoingCallerId callerId : callerIds) {
System.out.println(callerId.getPhoneNumber());
}
}
}