Skip to main content
GET
/
storage
/
buckets
/
{bucketName}
/
usage
/
api
JavaScript
import Telnyx from 'telnyx';

const client = new Telnyx({
  apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});

const response = await client.storage.buckets.usage.getAPIUsage('', {
  filter: { end_time: '2019-12-27T18:11:19.117Z', start_time: '2019-12-27T18:11:19.117Z' },
});

console.log(response.data);
import os
from datetime import datetime
from telnyx import Telnyx

client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.storage.buckets.usage.get_api_usage(
bucket_name="",
filter={
"end_time": datetime.fromisoformat("2019-12-27T18:11:19.117"),
"start_time": datetime.fromisoformat("2019-12-27T18:11:19.117"),
},
)
print(response.data)
package main

import (
"context"
"fmt"
"time"

"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)

func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Storage.Buckets.Usage.GetAPIUsage(
context.TODO(),
"",
telnyx.StorageBucketUsageGetAPIUsageParams{
Filter: telnyx.StorageBucketUsageGetAPIUsageParamsFilter{
EndTime: time.Now(),
StartTime: time.Now(),
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.telnyx.sdk.example;

import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.storage.buckets.usage.UsageGetApiUsageParams;
import com.telnyx.sdk.models.storage.buckets.usage.UsageGetApiUsageResponse;
import java.time.OffsetDateTime;

public final class Main {
private Main() {}

public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();

UsageGetApiUsageParams params = UsageGetApiUsageParams.builder()
.bucketName("")
.filter(UsageGetApiUsageParams.Filter.builder()
.endTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.build())
.build();
UsageGetApiUsageResponse response = client.storage().buckets().usage().getApiUsage(params);
}
}
require "telnyx"

telnyx = Telnyx::Client.new(api_key: "My API Key")

response = telnyx.storage.buckets.usage.get_api_usage(
"",
filter: {end_time: "2019-12-27T18:11:19.117Z", start_time: "2019-12-27T18:11:19.117Z"}
)

puts(response)
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;

$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');

try {
$response = $client->storage->buckets->usage->getAPIUsage(
'',
filter: [
'endTime' => new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
'startTime' => new \DateTimeImmutable('2019-12-27T18:11:19.117Z'),
],
);

var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}
telnyx storage:buckets:usage get-api-usage \
--api-key 'My API Key' \
--bucket-name '' \
--filter "{end_time: '2019-12-27T18:11:19.117Z', start_time: '2019-12-27T18:11:19.117Z'}"
curl --request GET \
--url https://api.telnyx.com/v2/storage/buckets/{bucketName}/usage/api \
--header 'Authorization: Bearer <token>'
{
  "data": [
    {
      "categories": [
        {
          "bytes_sent": 123456,
          "bytes_received": 123456,
          "ops": 123456,
          "successful_ops": 123456,
          "category": "put_obj"
        }
      ],
      "total": {
        "bytes_sent": 123456,
        "bytes_received": 123456,
        "ops": 123456,
        "successful_ops": 123456
      },
      "timestamp": "2020-01-01T00:00:00Z"
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

bucketName
string
required

The name of the bucket

Query Parameters

filter
object
required

Consolidated filter parameter (deepObject style). Originally: filter[start_time], filter[end_time]

Response

Bucket Usage

data
object[]