Note
All URIs are relative to https://api.fastly.com
Method | HTTP request | Description |
---|---|---|
GetServiceStats | GET /service/{service_id}/stats/summary |
Get stats for a service |
Get stats for a service
package main
import (
"context"
"fmt"
"os"
"github.com/fastly/fastly-go/fastly"
)
func main() {
serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
month := "05" // string | 2-digit month. (optional)
year := "2020" // string | 4-digit year. (optional)
startTime := int32(1608560817) // int32 | Epoch timestamp. Limits the results returned. (optional)
endTime := int32(1608560817) // int32 | Epoch timestamp. Limits the results returned. (optional)
cfg := fastly.NewConfiguration()
apiClient := fastly.NewAPIClient(cfg)
ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
resp, r, err := apiClient.StatsAPI.GetServiceStats(ctx, serviceID).Month(month).Year(year).StartTime(startTime).EndTime(endTime).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `StatsAPI.GetServiceStats`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetServiceStats`: Stats
fmt.Fprintf(os.Stdout, "Response from `StatsAPI.GetServiceStats`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
serviceID | string | Alphanumeric string identifying the service. |
Other parameters are passed through a pointer to a apiGetServiceStatsRequest struct via the builder pattern
Name | Type | Description | Notes |
---|---|---|---|
month | string | 2-digit month. | year |
- Content-Type: Not defined
- Accept: application/json