|
| 1 | +# WebService::Fastly::BillingUsageMetricsApi |
| 2 | + |
| 3 | +## Load the API package |
| 4 | +```perl |
| 5 | +use WebService::Fastly::Object::BillingUsageMetricsApi; |
| 6 | +``` |
| 7 | + |
| 8 | +> [!NOTE] |
| 9 | +> All URIs are relative to `https://api.fastly.com` |
| 10 | +
|
| 11 | +Method | HTTP request | Description |
| 12 | +------ | ------------ | ----------- |
| 13 | +[**get_service_level_usage**](BillingUsageMetricsApi.md#get_service_level_usage) | **GET** /billing/v2/account_customers/{customer_id}/service-usage-metrics | Retrieve service-level usage metrics for a product. |
| 14 | +[**get_service_level_usage_types**](BillingUsageMetricsApi.md#get_service_level_usage_types) | **GET** /billing/v2/account_customers/{customer_id}/service-usage-types | Retrieve product usage types for a customer. |
| 15 | + |
| 16 | + |
| 17 | +# **get_service_level_usage** |
| 18 | +> Serviceusagemetrics get_service_level_usage(customer_id => $customer_id, product_id => $product_id, usage_type_name => $usage_type_name, time_granularity => $time_granularity, start_date => $start_date, end_date => $end_date, start_month => $start_month, end_month => $end_month, limit => $limit, cursor => $cursor) |
| 19 | +
|
| 20 | +Retrieve service-level usage metrics for a product. |
| 21 | + |
| 22 | +Returns product usage, broken down by service. |
| 23 | + |
| 24 | +### Example |
| 25 | +```perl |
| 26 | +use Data::Dumper; |
| 27 | +use WebService::Fastly::BillingUsageMetricsApi; |
| 28 | +my $api_instance = WebService::Fastly::BillingUsageMetricsApi->new( |
| 29 | + |
| 30 | + # Configure API key authorization: token |
| 31 | + api_key => {'Fastly-Key' => 'YOUR_API_KEY'}, |
| 32 | + # uncomment below to setup prefix (e.g. Bearer) for API key, if needed |
| 33 | + #api_key_prefix => {'Fastly-Key' => 'Bearer'}, |
| 34 | +); |
| 35 | + |
| 36 | +my $customer_id = "customer_id_example"; # string | Alphanumeric string identifying the customer. |
| 37 | +my $product_id = "product_id_example"; # string | The product identifier for the metrics returned (e.g., `cdn_usage`). This field is not required for CSV requests. |
| 38 | +my $usage_type_name = "usage_type_name_example"; # string | The usage type name for the metrics returned (e.g., `North America Requests`). This field is not required for CSV requests. |
| 39 | +my $time_granularity = "time_granularity_example"; # string | |
| 40 | +my $start_date = 2023-01-01; # string | |
| 41 | +my $end_date = 2023-01-31; # string | |
| 42 | +my $start_month = 2023-01; # string | |
| 43 | +my $end_month = 2023-03; # string | |
| 44 | +my $limit = '5'; # string | Number of results per page. The maximum is 100. |
| 45 | +my $cursor = "cursor_example"; # string | Cursor value from the `next_cursor` field of a previous response, used to retrieve the next page. To request the first page, this should be empty. |
| 46 | + |
| 47 | +eval { |
| 48 | + my $result = $api_instance->get_service_level_usage(customer_id => $customer_id, product_id => $product_id, usage_type_name => $usage_type_name, time_granularity => $time_granularity, start_date => $start_date, end_date => $end_date, start_month => $start_month, end_month => $end_month, limit => $limit, cursor => $cursor); |
| 49 | + print Dumper($result); |
| 50 | +}; |
| 51 | +if ($@) { |
| 52 | + warn "Exception when calling BillingUsageMetricsApi->get_service_level_usage: $@\n"; |
| 53 | +} |
| 54 | +``` |
| 55 | + |
| 56 | +### Parameters |
| 57 | + |
| 58 | +Name | Type | Description | Notes |
| 59 | +------------- | ------------- | ------------- | ------------- |
| 60 | + **customer_id** | **string**| Alphanumeric string identifying the customer. | |
| 61 | + **product_id** | **string**| The product identifier for the metrics returned (e.g., `cdn_usage`). This field is not required for CSV requests. | |
| 62 | + **usage_type_name** | **string**| The usage type name for the metrics returned (e.g., `North America Requests`). This field is not required for CSV requests. | |
| 63 | + **time_granularity** | **string**| | |
| 64 | + **start_date** | **string**| | [optional] |
| 65 | + **end_date** | **string**| | [optional] |
| 66 | + **start_month** | **string**| | [optional] |
| 67 | + **end_month** | **string**| | [optional] |
| 68 | + **limit** | **string**| Number of results per page. The maximum is 100. | [optional] [default to '5'] |
| 69 | + **cursor** | **string**| Cursor value from the `next_cursor` field of a previous response, used to retrieve the next page. To request the first page, this should be empty. | [optional] |
| 70 | + |
| 71 | +### Return type |
| 72 | + |
| 73 | +[**Serviceusagemetrics**](Serviceusagemetrics.md) |
| 74 | + |
| 75 | +### Authorization |
| 76 | + |
| 77 | +[token](../README.md#token) |
| 78 | + |
| 79 | +### HTTP request headers |
| 80 | + |
| 81 | + - **Content-Type**: Not defined |
| 82 | + - **Accept**: application/json |
| 83 | + |
| 84 | +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) |
| 85 | + |
| 86 | +# **get_service_level_usage_types** |
| 87 | +> Serviceusagetypes get_service_level_usage_types(customer_id => $customer_id) |
| 88 | +
|
| 89 | +Retrieve product usage types for a customer. |
| 90 | + |
| 91 | +Returns product usage types reported by the customer's services. |
| 92 | + |
| 93 | +### Example |
| 94 | +```perl |
| 95 | +use Data::Dumper; |
| 96 | +use WebService::Fastly::BillingUsageMetricsApi; |
| 97 | +my $api_instance = WebService::Fastly::BillingUsageMetricsApi->new( |
| 98 | + |
| 99 | + # Configure API key authorization: token |
| 100 | + api_key => {'Fastly-Key' => 'YOUR_API_KEY'}, |
| 101 | + # uncomment below to setup prefix (e.g. Bearer) for API key, if needed |
| 102 | + #api_key_prefix => {'Fastly-Key' => 'Bearer'}, |
| 103 | +); |
| 104 | + |
| 105 | +my $customer_id = "customer_id_example"; # string | Alphanumeric string identifying the customer. |
| 106 | + |
| 107 | +eval { |
| 108 | + my $result = $api_instance->get_service_level_usage_types(customer_id => $customer_id); |
| 109 | + print Dumper($result); |
| 110 | +}; |
| 111 | +if ($@) { |
| 112 | + warn "Exception when calling BillingUsageMetricsApi->get_service_level_usage_types: $@\n"; |
| 113 | +} |
| 114 | +``` |
| 115 | + |
| 116 | +### Parameters |
| 117 | + |
| 118 | +Name | Type | Description | Notes |
| 119 | +------------- | ------------- | ------------- | ------------- |
| 120 | + **customer_id** | **string**| Alphanumeric string identifying the customer. | |
| 121 | + |
| 122 | +### Return type |
| 123 | + |
| 124 | +[**Serviceusagetypes**](Serviceusagetypes.md) |
| 125 | + |
| 126 | +### Authorization |
| 127 | + |
| 128 | +[token](../README.md#token) |
| 129 | + |
| 130 | +### HTTP request headers |
| 131 | + |
| 132 | + - **Content-Type**: Not defined |
| 133 | + - **Accept**: application/json |
| 134 | + |
| 135 | +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) |
| 136 | + |
0 commit comments