Create a new legacy usage V2 MDR report request
Creates a new legacy usage V2 MDR report request with the specified filters
POST
/
legacy_reporting
/
usage_reports
/
messaging
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const messaging = await client.legacy.reporting.usageReports.messaging.create({
aggregation_type: 0,
});
console.log(messaging.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
messaging = client.legacy.reporting.usage_reports.messaging.create(
aggregation_type=0,
)
print(messaging.data)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
messaging, err := client.Legacy.Reporting.UsageReports.Messaging.New(context.TODO(), telnyx.LegacyReportingUsageReportMessagingNewParams{
AggregationType: 0,
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", messaging.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.legacy.reporting.usagereports.messaging.MessagingCreateParams;
import com.telnyx.sdk.models.legacy.reporting.usagereports.messaging.MessagingCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
MessagingCreateParams params = MessagingCreateParams.builder()
.aggregationType(0)
.build();
MessagingCreateResponse messaging = client.legacy().reporting().usageReports().messaging().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
messaging = telnyx.legacy.reporting.usage_reports.messaging.create(aggregation_type: 0)
puts(messaging)<?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 {
$messaging = $client->legacy->reporting->usageReports->messaging->create(
aggregationType: 0,
endTime: new \DateTimeImmutable('2020-01-02T00:00:00Z'),
managedAccounts: [
'f47ac10b-58cc-4372-a567-0e02b2c3d479',
'6ba7b810-9dad-11d1-80b4-00c04fd430c8',
],
profiles: [
'3fa85f64-5717-4562-b3fc-2c963f66afa6',
'7d4e3f8a-9b2c-4e1d-8f5a-1a2b3c4d5e6f',
],
selectAllManagedAccounts: true,
startTime: new \DateTimeImmutable('2020-01-01T00:00:00Z'),
);
var_dump($messaging);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx legacy:reporting:usage-reports:messaging create \
--api-key 'My API Key' \
--aggregation-type 0curl --request POST \
--url https://api.telnyx.com/v2/legacy_reporting/usage_reports/messaging \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: */*' \
--data '
{
"aggregation_type": 0,
"start_time": "2020-01-01T00:00:00Z",
"end_time": "2020-01-02T00:00:00Z",
"profiles": [
"3fa85f64-5717-4562-b3fc-2c963f66afa6",
"7d4e3f8a-9b2c-4e1d-8f5a-1a2b3c4d5e6f"
],
"select_all_managed_accounts": true,
"managed_accounts": [
"f47ac10b-58cc-4372-a567-0e02b2c3d479",
"6ba7b810-9dad-11d1-80b4-00c04fd430c8"
]
}
'{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"start_time": "2018-02-02T22:25:27.521Z",
"end_time": "2018-02-02T22:25:27.521Z",
"connections": [
"1234567890",
"9876543210"
],
"aggregation_type": 123,
"status": 123,
"report_url": "http://portal.telnyx.com/downloads/report_name_8hvb45Gu.csv",
"result": {},
"created_at": "2018-02-02T22:25:27.521Z",
"updated_at": "2018-02-02T22:25:27.521Z",
"profiles": [
"3fa85f64-5717-4562-b3fc-2c963f66afa6",
"7d4e3f8a-9b2c-4e1d-8f5a-1a2b3c4d5e6f"
],
"record_type": "mdr_usage_report_v2_legacy"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
*/*
MDR detail request data
MDR usage request parameters
Aggregation type: No aggregation = 0, By Messaging Profile = 1, By Tags = 2
Example:
0
Example:
"2020-01-01T00:00:00Z"
Example:
"2020-01-02T00:00:00Z"
List of messaging profile IDs to filter by
Example:
[
"3fa85f64-5717-4562-b3fc-2c963f66afa6",
"7d4e3f8a-9b2c-4e1d-8f5a-1a2b3c4d5e6f"
]Example:
true
List of managed accounts to include
Example:
[
"f47ac10b-58cc-4372-a567-0e02b2c3d479",
"6ba7b810-9dad-11d1-80b4-00c04fd430c8"
]Response
V2 legacy MDR usage report request created successfully
Legacy V2 MDR usage report response
Show child attributes
Show child attributes
Was this page helpful?
⌘I
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const messaging = await client.legacy.reporting.usageReports.messaging.create({
aggregation_type: 0,
});
console.log(messaging.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
messaging = client.legacy.reporting.usage_reports.messaging.create(
aggregation_type=0,
)
print(messaging.data)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
messaging, err := client.Legacy.Reporting.UsageReports.Messaging.New(context.TODO(), telnyx.LegacyReportingUsageReportMessagingNewParams{
AggregationType: 0,
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", messaging.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.legacy.reporting.usagereports.messaging.MessagingCreateParams;
import com.telnyx.sdk.models.legacy.reporting.usagereports.messaging.MessagingCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
MessagingCreateParams params = MessagingCreateParams.builder()
.aggregationType(0)
.build();
MessagingCreateResponse messaging = client.legacy().reporting().usageReports().messaging().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
messaging = telnyx.legacy.reporting.usage_reports.messaging.create(aggregation_type: 0)
puts(messaging)<?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 {
$messaging = $client->legacy->reporting->usageReports->messaging->create(
aggregationType: 0,
endTime: new \DateTimeImmutable('2020-01-02T00:00:00Z'),
managedAccounts: [
'f47ac10b-58cc-4372-a567-0e02b2c3d479',
'6ba7b810-9dad-11d1-80b4-00c04fd430c8',
],
profiles: [
'3fa85f64-5717-4562-b3fc-2c963f66afa6',
'7d4e3f8a-9b2c-4e1d-8f5a-1a2b3c4d5e6f',
],
selectAllManagedAccounts: true,
startTime: new \DateTimeImmutable('2020-01-01T00:00:00Z'),
);
var_dump($messaging);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx legacy:reporting:usage-reports:messaging create \
--api-key 'My API Key' \
--aggregation-type 0curl --request POST \
--url https://api.telnyx.com/v2/legacy_reporting/usage_reports/messaging \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: */*' \
--data '
{
"aggregation_type": 0,
"start_time": "2020-01-01T00:00:00Z",
"end_time": "2020-01-02T00:00:00Z",
"profiles": [
"3fa85f64-5717-4562-b3fc-2c963f66afa6",
"7d4e3f8a-9b2c-4e1d-8f5a-1a2b3c4d5e6f"
],
"select_all_managed_accounts": true,
"managed_accounts": [
"f47ac10b-58cc-4372-a567-0e02b2c3d479",
"6ba7b810-9dad-11d1-80b4-00c04fd430c8"
]
}
'{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"start_time": "2018-02-02T22:25:27.521Z",
"end_time": "2018-02-02T22:25:27.521Z",
"connections": [
"1234567890",
"9876543210"
],
"aggregation_type": 123,
"status": 123,
"report_url": "http://portal.telnyx.com/downloads/report_name_8hvb45Gu.csv",
"result": {},
"created_at": "2018-02-02T22:25:27.521Z",
"updated_at": "2018-02-02T22:25:27.521Z",
"profiles": [
"3fa85f64-5717-4562-b3fc-2c963f66afa6",
"7d4e3f8a-9b2c-4e1d-8f5a-1a2b3c4d5e6f"
],
"record_type": "mdr_usage_report_v2_legacy"
}
}