Skip to content

Latest commit

 

History

History
171 lines (127 loc) · 7.69 KB

ConnectionsApi.md

File metadata and controls

171 lines (127 loc) · 7.69 KB

ConnectionsApi

All URIs are relative to https://api.telnyx.com/v2

Method HTTP request Description
listConnections GET /connections List connections
retrieveConnection GET /connections/{id} Retrieve a connection

listConnections

ListConnectionsResponse listConnections().pageNumber(pageNumber).pageSize(pageSize).filterConnectionNameContains(filterConnectionNameContains).filterOutboundOutboundVoiceProfileId(filterOutboundOutboundVoiceProfileId).sort(sort).execute();

List connections

Returns a list of your connections irrespective of type.

Example

// 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.ConnectionsApi;

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");

        ConnectionsApi apiInstance = new ConnectionsApi(defaultClient);
        Integer pageNumber = 1; // Integer | The page number to load
        Integer pageSize = 20; // Integer | The size of the page
        String filterConnectionNameContains = "My Connection"; // String | If present, connections with <code>connection_name</code> containing the given value will be returned. Matching is not case-sensitive. Requires at least three characters.
        String filterOutboundOutboundVoiceProfileId = "1293384261075731499"; // String | Identifies the associated outbound voice profile.
        String sort = "created_at"; // String | Specifies the sort order for results. By default sorting direction is ascending. To have the results sorted in descending order add the <code> -</code> prefix.<br/><br/> That is: <ul>   <li>     <code>connection_name</code>: sorts the result by the     <code>connection_name</code> field in ascending order.   </li>    <li>     <code>-connection_name</code>: sorts the result by the     <code>connection_name</code> field in descending order.   </li> </ul> <br/> If not given, results are sorted by <code>created_at</code> in descending order.
        try {
            ListConnectionsResponse result = api.listConnections()
                .pageNumber(pageNumber)
                .pageSize(pageSize)
                .filterConnectionNameContains(filterConnectionNameContains)
                .filterOutboundOutboundVoiceProfileId(filterOutboundOutboundVoiceProfileId)
                .sort(sort)
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling ConnectionsApi#listConnections");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

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]
filterConnectionNameContains String If present, connections with <code>connection_name</code> containing the given value will be returned. Matching is not case-sensitive. Requires at least three characters. [optional]
filterOutboundOutboundVoiceProfileId String Identifies the associated outbound voice profile. [optional]
sort String Specifies the sort order for results. By default sorting direction is ascending. To have the results sorted in descending order add the <code> -</code> prefix.<br/><br/> That is: <ul> <li> <code>connection_name</code>: sorts the result by the <code>connection_name</code> field in ascending order. </li> <li> <code>-connection_name</code>: sorts the result by the <code>connection_name</code> field in descending order. </li> </ul> <br/> If not given, results are sorted by <code>created_at</code> in descending order. [optional] [default to created_at] [enum: created_at, connection_name, active]

Return type

ListConnectionsResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful response with a list of connections. -
400 Bad request, the request was unacceptable, often due to missing a required parameter. -
401 Unauthorized -
403 Unauthenticated response. Happens when the current user cannot be authenticated. -

retrieveConnection

ConnectionResponse retrieveConnection(id)

Retrieve a connection

Retrieves the high-level details of an existing connection. To retrieve specific authentication information, use the endpoint for the specific connection type.

Example

// 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.ConnectionsApi;

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");

        ConnectionsApi apiInstance = new ConnectionsApi(defaultClient);
        String id = "id_example"; // String | IP Connection ID
        try {
            ConnectionResponse result = apiInstance.retrieveConnection(id);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling ConnectionsApi#retrieveConnection");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
id String IP Connection ID

Return type

ConnectionResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful response with details about a connection. -
400 Bad request, the request was unacceptable, often due to missing a required parameter. -
401 Unauthorized -
403 Unauthenticated response. Happens when the current user cannot be authenticated. -
404 Resource not found -