All URIs are relative to https://api.telnyx.com/v2
Method | HTTP request | Description |
---|---|---|
listShortCodes | GET /short_codes | List short codes |
retrieveShortCode | GET /short_codes/{id} | Retrieve a short code |
updateShortCode | PATCH /short_codes/{id} | Update short code |
ListShortCodesResponse listShortCodes().pageNumber(pageNumber).pageSize(pageSize).filterMessagingProfileId(filterMessagingProfileId).execute();
List short codes
// Import classes:
import com.telnyx.sdk.ApiClient;
import com.telnyx.sdk.ApiException;
import com.telnyx.sdk.Configuration;
import com.telnyx.sdk.auth.*;
import com.telnyx.sdk.model.*;
import com.telnyx.sdk.api.ShortCodesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.telnyx.com/v2");
// Configure HTTP bearer authorization: bearerAuth
HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
bearerAuth.setBearerToken("BEARER TOKEN");
ShortCodesApi apiInstance = new ShortCodesApi(defaultClient);
Integer pageNumber = 1; // Integer | The page number to load
Integer pageSize = 20; // Integer | The size of the page
String filterMessagingProfileId = "filterMessagingProfileId_example"; // String | Filter by Messaging Profile ID. Use the string `null` for phone numbers without assigned profiles. A synonym for the `/messaging_profiles/{id}/short_codes` endpoint when querying about an extant profile.
try {
ListShortCodesResponse result = api.listShortCodes()
.pageNumber(pageNumber)
.pageSize(pageSize)
.filterMessagingProfileId(filterMessagingProfileId)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ShortCodesApi#listShortCodes");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
pageNumber | Integer | The page number to load | [optional] [default to 1] |
pageSize | Integer | The size of the page | [optional] [default to 20] |
filterMessagingProfileId | String | Filter by Messaging Profile ID. Use the string `null` for phone numbers without assigned profiles. A synonym for the `/messaging_profiles/{id}/short_codes` endpoint when querying about an extant profile. | [optional] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successful response with a list of short codes. | - |
0 | Unexpected error | - |
ShortCodeResponse retrieveShortCode(id)
Retrieve a short code
import java.util.UUID;
// Import classes:
import com.telnyx.sdk.ApiClient;
import com.telnyx.sdk.ApiException;
import com.telnyx.sdk.Configuration;
import com.telnyx.sdk.auth.*;
import com.telnyx.sdk.model.*;
import com.telnyx.sdk.api.ShortCodesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.telnyx.com/v2");
// Configure HTTP bearer authorization: bearerAuth
HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
bearerAuth.setBearerToken("BEARER TOKEN");
ShortCodesApi apiInstance = new ShortCodesApi(defaultClient);
UUID id = UUID.randomUUID(); // UUID | The id of the short code
try {
ShortCodeResponse result = apiInstance.retrieveShortCode(id);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ShortCodesApi#retrieveShortCode");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
id | UUID | The id of the short code |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successful response with details about a short code. | - |
0 | Unexpected error | - |
ShortCodeResponse updateShortCode(id, updateShortCodeRequest)
Update short code
Update the settings for a specific short code. To unbind a short code from a profile, set the messaging_profile_id
to null
or an empty string.
import java.util.UUID;
// Import classes:
import com.telnyx.sdk.ApiClient;
import com.telnyx.sdk.ApiException;
import com.telnyx.sdk.Configuration;
import com.telnyx.sdk.auth.*;
import com.telnyx.sdk.model.*;
import com.telnyx.sdk.api.ShortCodesApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.telnyx.com/v2");
// Configure HTTP bearer authorization: bearerAuth
HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
bearerAuth.setBearerToken("BEARER TOKEN");
ShortCodesApi apiInstance = new ShortCodesApi(defaultClient);
UUID id = UUID.randomUUID(); // UUID | The id of the short code
UpdateShortCodeRequest updateShortCodeRequest = new UpdateShortCodeRequest(); // UpdateShortCodeRequest | Short code update
try {
ShortCodeResponse result = apiInstance.updateShortCode(id, updateShortCodeRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ShortCodesApi#updateShortCode");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
id | UUID | The id of the short code | |
updateShortCodeRequest | UpdateShortCodeRequest | Short code update |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successful response with details about a short code. | - |
0 | Unexpected error | - |