Package com.vonage.client.numbers
Class NumbersClient
java.lang.Object
com.vonage.client.numbers.NumbersClient
A client for accessing the Vonage API calls that manage phone numbers. The standard way to obtain an instance of
this class is to use
VonageClient.getNumbersClient().-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidStart renting a Vonage Virtual Number.voidStart renting a Vonage Virtual Number.voidcancelNumber(String country, String msisdn) Stop renting a Vonage Virtual Number.voidcancelNumber(String country, String msisdn, String targetApiKey) Stop renting a Vonage Virtual Number.voidlinkNumber(String msisdn, String country, String appId) Link a given Vonage Virtual Number to a Vonage Application with the given ID.Get the first page of phone numbers assigned to the authenticated account.listNumbers(ListNumbersFilter filter) Get a filtered set of numbers assigned to the authenticated account.searchNumbers(SearchNumbersFilter filter) Search for available Vonage Virtual Numbers.searchNumbers(String country) Search for available Vonage Virtual Numbers.voidupdateNumber(UpdateNumberRequest request) Update the callbacks and/or application associations for a given Vonage Virtual Number.
-
Constructor Details
-
NumbersClient
-
-
Method Details
-
listNumbers
Get the first page of phone numbers assigned to the authenticated account.- Returns:
- A ListNumbersResponse containing the first 10 phone numbers
- Throws:
NumbersResponseException- If the API call returned an unsuccessful (4xx or 5xx) response.
-
listNumbers
Get a filtered set of numbers assigned to the authenticated account.- Parameters:
filter- A ListNumbersFilter describing the filters to be applied to the request.- Returns:
- A ListNumbersResponse containing phone numbers matching the supplied filter.
- Throws:
NumbersResponseException- If the API call returned an unsuccessful (4xx or 5xx) response.
-
searchNumbers
Search for available Vonage Virtual Numbers.- Parameters:
country- Country to search available numbers from.- Returns:
- Available Vonage Virtual Numbers.
- Throws:
NumbersResponseException- If the API call returned an unsuccessful (4xx or 5xx) response.
-
searchNumbers
public SearchNumbersResponse searchNumbers(SearchNumbersFilter filter) throws NumbersResponseException Search for available Vonage Virtual Numbers.- Parameters:
filter- search for available Vonage Virtual Number with filters- Returns:
- The available Vonage Virtual Numbers.
- Throws:
NumbersResponseException- If the API call returned an unsuccessful (4xx or 5xx) response.
-
buyNumber
Start renting a Vonage Virtual Number.- Parameters:
country- The two character country code in ISO 3166-1 alpha-2 format.msisdn- The phone number to be bought in E.164 format.- Throws:
NumbersResponseException- If the API call returned an unsuccessful (4xx or 5xx) response.
-
buyNumber
public void buyNumber(String country, String msisdn, String targetApiKey) throws NumbersResponseException Start renting a Vonage Virtual Number.- Parameters:
country- The two character country code in ISO 3166-1 alpha-2 format.msisdn- The phone number to be bought in E.164 format.targetApiKey- If you’d like to perform an action on a subaccount, provide the API key of that account here. If you’d like to perform an action on your own account, you do not need to provide this field.- Throws:
NumbersResponseException- If the API call returned an unsuccessful (4xx or 5xx) response.- Since:
- 8.10.0
- See Also:
-
cancelNumber
Stop renting a Vonage Virtual Number.- Parameters:
country- The two character country code in ISO 3166-1 alpha-2 format.msisdn- The phone number to be cancelled in E.164 format.- Throws:
NumbersResponseException- If the API call returned an unsuccessful (4xx or 5xx) response.
-
cancelNumber
public void cancelNumber(String country, String msisdn, String targetApiKey) throws NumbersResponseException Stop renting a Vonage Virtual Number.- Parameters:
country- The two character country code in ISO 3166-1 alpha-2 format.msisdn- The phone number to be cancelled in E.164 format.targetApiKey- If you’d like to perform an action on a subaccount, provide the API key of that account here. If you’d like to perform an action on your own account, you do not need to provide this field.- Throws:
NumbersResponseException- If the API call returned an unsuccessful (4xx or 5xx) response.- Since:
- 8.10.0
- See Also:
-
updateNumber
Update the callbacks and/or application associations for a given Vonage Virtual Number.- Parameters:
request- Details of the updates to be made to the number association.- Throws:
NumbersResponseException- If the API call returned an unsuccessful (4xx or 5xx) response.
-
linkNumber
Link a given Vonage Virtual Number to a Vonage Application with the given ID.- Parameters:
msisdn- The Vonage Virtual Number to be updated.country- The country for the given msisdn.appId- The UUID for the Vonage Application to be associated with the number.- Throws:
NumbersResponseException- If the API call returned an unsuccessful (4xx or 5xx) response.
-