Sha256: 8dcfd3c1d0595bd5d1e642fad555ce382685e2a9c73bc7f75452364d0f0e31d9

Contents?: true

Size: 1.93 KB

Versions: 8

Compression:

Stored size: 1.93 KB

Contents

# Fastly::StatsApi


```ruby
require 'fastly'
api_instance = Fastly::StatsApi.new
```

## Methods

> [!NOTE]
> All URIs are relative to `https://api.fastly.com`

Method | HTTP request | Description
------ | ------------ | -----------
[**get_service_stats**](StatsApi.md#get_service_stats) | **GET** /service/{service_id}/stats/summary | Get stats for a service


## `get_service_stats()`

```ruby
get_service_stats(opts): <Stats> # Get stats for a service
```

Get the stats from a service for a block of time. This lists all stats by PoP location, starting with AMS. This call requires parameters to select block of time to query. Use either a timestamp range (using start_time and end_time) or a specified month/year combo (using month and year).

### Examples

```ruby
api_instance = Fastly::StatsApi.new
opts = {
    service_id: 'service_id_example', # String | Alphanumeric string identifying the service.
    month: '05', # String | 2-digit month.
    year: '2020', # String | 4-digit year.
    start_time: 1608560817, # Integer | Epoch timestamp. Limits the results returned.
    end_time: 1608560817, # Integer | Epoch timestamp. Limits the results returned.
}

begin
  # Get stats for a service
  result = api_instance.get_service_stats(opts)
  p result
rescue Fastly::ApiError => e
  puts "Error when calling StatsApi->get_service_stats: #{e}"
end
```

### Options

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **service_id** | **String** | Alphanumeric string identifying the service. |  |
| **month** | **String** | 2-digit month. | [optional] |
| **year** | **String** | 4-digit year. | [optional] |
| **start_time** | **Integer** | Epoch timestamp. Limits the results returned. | [optional] |
| **end_time** | **Integer** | Epoch timestamp. Limits the results returned. | [optional] |

### Return type

[**Stats**](Stats.md)

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to README]](../../README.md)

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fastly-9.0.0 docs/StatsApi.md
fastly-8.10.0 docs/StatsApi.md
fastly-8.9.0 docs/StatsApi.md
fastly-8.8.0 docs/StatsApi.md
fastly-8.7.0 docs/StatsApi.md
fastly-8.6.0 docs/StatsApi.md
fastly-8.5.0 docs/StatsApi.md
fastly-8.4.0 docs/StatsApi.md