Sha256: 0dca9e61fc071ed5687b0afbac9d1fb772d9be9d5bd9c0290160d41120b7ad33

Contents?: true

Size: 1.88 KB

Versions: 30

Compression:

Stored size: 1.88 KB

Contents

# Fastly::StatsApi


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

## Methods

| 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

30 entries across 30 versions & 1 rubygems

Version Path
fastly-8.2.0 docs/StatsApi.md
fastly-8.1.0 docs/StatsApi.md
fastly-8.0.1 docs/StatsApi.md
fastly-8.0.0 docs/StatsApi.md
fastly-7.2.2 docs/StatsApi.md
fastly-7.2.1 docs/StatsApi.md
fastly-7.2.0 docs/StatsApi.md
fastly-7.1.1 docs/StatsApi.md
fastly-7.1.0 docs/StatsApi.md
fastly-7.0.0 docs/StatsApi.md
fastly-6.0.2 docs/StatsApi.md
fastly-6.0.1 docs/StatsApi.md
fastly-6.0.0 docs/StatsApi.md
fastly-5.3.1 docs/StatsApi.md
fastly-5.3.0 docs/StatsApi.md
fastly-5.2.2 docs/StatsApi.md
fastly-5.2.1 docs/StatsApi.md
fastly-5.2.0 docs/StatsApi.md
fastly-5.1.1 docs/StatsApi.md
fastly-5.1.0 docs/StatsApi.md