# MetricsPlatformApi
> [!NOTE]
> All URIs are relative to `https://api.fastly.com`
[**get_platform_metrics_aggregate_historical**](MetricsPlatformApi.md#get_platform_metrics_aggregate_historical) | **GET** /metrics/v2/platform/aggregate/{granularity} | Get aggregated historical time series metrics for all entities
[**get_platform_metrics_entity_historical**](MetricsPlatformApi.md#get_platform_metrics_entity_historical) | **GET** /metrics/v2/platform/entities/{entity_id}/{granularity} | Get historical time series metrics for a single entity.
## get_platform_metrics_aggregate_historical
Fetches historical metrics for all entities for a customer for a given granularity. Entity in this context refers to an instance of a Fastly resource, such as a VCL service, Compute service, or NGWAF workspace.
```rust
let cfg = &Configuration::default();
let params = GetPlatformMetricsAggregateHistoricalParams {
// parameters
};
get_platform_metrics_aggregate_historical(cfg, params)
```
### Parameters
**granularity** | **String** | Duration of sample windows. | [required] |
**from** | Option\<**String**> | A valid RFC-8339-formatted date and time indicating the inclusive start of the query time range. If not provided, a default is chosen based on the provided `granularity` value. | |
**to** | Option\<**String**> | A valid RFC-8339-formatted date and time indicating the exclusive end of the query time range. If not provided, a default is chosen based on the provided `granularity` value. | |
**metric** | Option\<**String**> | One or more metrics to retrieve. Multiple values should be comma-separated. | |
**metric_set** | Option\<**String**> | One or more metric sets to retrieve. Multiple values should be comma-separated. A metric set expands to a list of metrics; see the Metric Sets section above for the metrics in each set. A metric that appears in more than one requested set is returned once. | |
**group_by** | Option\<**String**> | Field to group_by in the query. For example, `group_by=region` will return entries for grouped by timestamp and region. | |
**region** | Option\<**String**> | Limit query to one or more specific geographic regions. Values should be comma-separated. | |
**datacenter** | Option\<**String**> | Limit query to one or more specific POPs. Values should be comma-separated. | |
**cursor** | Option\<**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. | |
**limit** | Option\<**String**> | Number of results per page. The maximum is 10000. | |[default to 1000]
### Return type
[**crate::models::PlatformMetricsResponse**](PlatformMetricsResponse.md)
### Authorization
[token](../README.md#token)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
## get_platform_metrics_entity_historical
Fetches historical metrics for a single entity for a given granularity. Entity in this context refers to an instance of a Fastly resource, such as a VCL service, Compute service, or NGWAF workspace.
```rust
let cfg = &Configuration::default();
let params = GetPlatformMetricsEntityHistoricalParams {
// parameters
};
get_platform_metrics_entity_historical(cfg, params)
```
### Parameters
**entity_id** | **String** | Alphanumeric string identifying the entity. | [required] |
**granularity** | **String** | Duration of sample windows. | [required] |
**from** | Option\<**String**> | A valid RFC-8339-formatted date and time indicating the inclusive start of the query time range. If not provided, a default is chosen based on the provided `granularity` value. | |
**to** | Option\<**String**> | A valid RFC-8339-formatted date and time indicating the exclusive end of the query time range. If not provided, a default is chosen based on the provided `granularity` value. | |
**metric** | Option\<**String**> | One or more metrics to retrieve. Multiple values should be comma-separated. | |
**metric_set** | Option\<**String**> | One or more metric sets to retrieve. Multiple values should be comma-separated. A metric set expands to a list of metrics; see the Metric Sets section above for the metrics in each set. A metric that appears in more than one requested set is returned once. | |
**group_by** | Option\<**String**> | Field to group_by in the query. For example, `group_by=region` will return entries for grouped by timestamp and region. | |
**region** | Option\<**String**> | Limit query to one or more specific geographic regions. Values should be comma-separated. | |
**datacenter** | Option\<**String**> | Limit query to one or more specific POPs. Values should be comma-separated. | |
**cursor** | Option\<**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. | |
**limit** | Option\<**String**> | Number of results per page. The maximum is 10000. | |[default to 1000]
### Return type
[**crate::models::PlatformMetricsResponse**](PlatformMetricsResponse.md)
### Authorization
[token](../README.md#token)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)