All URIs are relative to https://api.telnyx.com/v2
| Method | HTTP request | Description |
|---|---|---|
| createPhoneNumberBlockDeletionJob | POST /phone_number_blocks/jobs/delete_phone_number_block | Deletes all numbers associated with a phone number block |
| getPhoneNumberBlocksJob | GET /phone_number_blocks/jobs/{id} | Retrieves a phone number blocks job |
| listPhoneNumberBlocksJobs | GET /phone_number_blocks/jobs | Lists the phone number blocks jobs |
PhoneNumberBlocksJobDeletePhoneNumberBlock createPhoneNumberBlockDeletionJob().phoneNumberBlocksJobDeletePhoneNumberBlockRequest(phoneNumberBlocksJobDeletePhoneNumberBlockRequest).execute();
Deletes all numbers associated with a phone number block
Creates a new background job to delete all the phone numbers associated with the given block. We will only consider the phone number block as deleted after all phone numbers associated with it are removed, so multiple executions of this job may be necessary in case some of the phone numbers present errors during the deletion process.
// 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.PhoneNumberBlocksBackgroundJobsApi;
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");
PhoneNumberBlocksBackgroundJobsApi apiInstance = new PhoneNumberBlocksBackgroundJobsApi(defaultClient);
PhoneNumberBlocksJobDeletePhoneNumberBlockRequest phoneNumberBlocksJobDeletePhoneNumberBlockRequest = new PhoneNumberBlocksJobDeletePhoneNumberBlockRequest(); // PhoneNumberBlocksJobDeletePhoneNumberBlockRequest |
try {
PhoneNumberBlocksJobDeletePhoneNumberBlock result = api.createPhoneNumberBlockDeletionJob()
.phoneNumberBlocksJobDeletePhoneNumberBlockRequest(phoneNumberBlocksJobDeletePhoneNumberBlockRequest)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling PhoneNumberBlocksBackgroundJobsApi#createPhoneNumberBlockDeletionJob");
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 |
|---|---|---|---|
| phoneNumberBlocksJobDeletePhoneNumberBlockRequest | PhoneNumberBlocksJobDeletePhoneNumberBlockRequest |
PhoneNumberBlocksJobDeletePhoneNumberBlock
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 202 | Phone number blocks job delete phone numbers requested. | - |
| 0 | Unexpected error | - |
PhoneNumberBlocksJob getPhoneNumberBlocksJob(id).execute();
Retrieves a phone number blocks job
// 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.PhoneNumberBlocksBackgroundJobsApi;
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");
PhoneNumberBlocksBackgroundJobsApi apiInstance = new PhoneNumberBlocksBackgroundJobsApi(defaultClient);
String id = "id_example"; // String | Identifies the Phone Number Blocks Job.
try {
PhoneNumberBlocksJob result = api.getPhoneNumberBlocksJob(id)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling PhoneNumberBlocksBackgroundJobsApi#getPhoneNumberBlocksJob");
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 | String | Identifies the Phone Number Blocks Job. |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Phone number blocks job details. | - |
| 0 | Unexpected error | - |
ListPhoneNumberBlocksBackgroundJobsResponse listPhoneNumberBlocksJobs().filterType(filterType).filterStatus(filterStatus).pageNumber(pageNumber).pageSize(pageSize).sort(sort).execute();
Lists the phone number blocks jobs
// 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.PhoneNumberBlocksBackgroundJobsApi;
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");
PhoneNumberBlocksBackgroundJobsApi apiInstance = new PhoneNumberBlocksBackgroundJobsApi(defaultClient);
String filterType = "delete_phone_number_block"; // String | Filter the phone number blocks jobs by type.
String filterStatus = "pending"; // String | Filter the phone number blocks jobs by status.
Integer pageNumber = 1; // Integer | The page number to load
Integer pageSize = 20; // Integer | The size of the page
String sort = "created_at"; // String | Specifies the sort order for results. If not given, results are sorted by created_at in descending order.
try {
ListPhoneNumberBlocksBackgroundJobsResponse result = api.listPhoneNumberBlocksJobs()
.filterType(filterType)
.filterStatus(filterStatus)
.pageNumber(pageNumber)
.pageSize(pageSize)
.sort(sort)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling PhoneNumberBlocksBackgroundJobsApi#listPhoneNumberBlocksJobs");
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 |
|---|---|---|---|
| filterType | String | Filter the phone number blocks jobs by type. | [optional] [enum: delete_phone_number_block] |
| filterStatus | String | Filter the phone number blocks jobs by status. | [optional] [enum: pending, in_progress, completed, failed] |
| pageNumber | Integer | The page number to load | [optional] [default to 1] |
| pageSize | Integer | The size of the page | [optional] [default to 20] |
| sort | String | Specifies the sort order for results. If not given, results are sorted by created_at in descending order. | [optional] [enum: created_at] |
ListPhoneNumberBlocksBackgroundJobsResponse
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successful response with a list of phone number blocks background jobs. | - |
| 0 | Unexpected error | - |