Skip to content

Latest commit

 

History

History
289 lines (206 loc) · 7.95 KB

BucketApi.md

File metadata and controls

289 lines (206 loc) · 7.95 KB

BucketApi

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

Method HTTP request Description
createBucket PUT /{bucketName} CreateBucket
deleteBucket DELETE /{bucketName} DeleteBucket
headBucket HEAD /{bucketName} HeadBucket
listBuckets GET / ListBuckets

createBucket

createBucket(bucketName, createBucketRequest)

CreateBucket

Create a bucket.

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.BucketApi;

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

        BucketApi apiInstance = new BucketApi(defaultClient);
        String bucketName = "mybucket"; // String | The name of the bucket.
        CreateBucketRequest createBucketRequest = new CreateBucketRequest(); // CreateBucketRequest | 
        try {
            apiInstance.createBucket(bucketName, createBucketRequest);
        } catch (ApiException e) {
            System.err.println("Exception when calling BucketApi#createBucket");
            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
bucketName String The name of the bucket.
createBucketRequest CreateBucketRequest [optional]

Return type

null (empty response body)

Authorization

bearerAuth

HTTP request headers

  • Content-Type: text/xml
  • Accept: text/xml

HTTP response details

Status code Description Response headers
200 Success -
409 BucketAlreadyExists -

deleteBucket

deleteBucket(bucketName)

DeleteBucket

Deletes a bucket. The bucket must be empty for it to be deleted.

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.BucketApi;

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

        BucketApi apiInstance = new BucketApi(defaultClient);
        String bucketName = "bucketName_example"; // String | The name of the bucket.
        try {
            apiInstance.deleteBucket(bucketName);
        } catch (ApiException e) {
            System.err.println("Exception when calling BucketApi#deleteBucket");
            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
bucketName String The name of the bucket.

Return type

null (empty response body)

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

HTTP response details

Status code Description Response headers
204 Success -

headBucket

headBucket(bucketName)

HeadBucket

Determines if a bucket exists and you have permission to access it.

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.BucketApi;

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

        BucketApi apiInstance = new BucketApi(defaultClient);
        String bucketName = "bucketName_example"; // String | The name of the bucket.
        try {
            apiInstance.headBucket(bucketName);
        } catch (ApiException e) {
            System.err.println("Exception when calling BucketApi#headBucket");
            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
bucketName String The name of the bucket.

Return type

null (empty response body)

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

HTTP response details

Status code Description Response headers
200 Success -
404 NoSuchBucket -

listBuckets

ListBucketsResponse listBuckets()

ListBuckets

List all Buckets.

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.BucketApi;

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

        BucketApi apiInstance = new BucketApi(defaultClient);
        try {
            ListBucketsResponse result = apiInstance.listBuckets();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling BucketApi#listBuckets");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

This endpoint does not need any parameter.

Return type

ListBucketsResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: text/xml

HTTP response details

Status code Description Response headers
200 Success -