Skip to content

Latest commit

 

History

History
152 lines (100 loc) · 5.29 KB

SettingsAPI.md

File metadata and controls

152 lines (100 loc) · 5.29 KB

SettingsAPI

Note

All URIs are relative to https://api.fastly.com

Method HTTP request Description
GetServiceSettings GET /service/{service_id}/version/{version_id}/settings Get service settings
UpdateServiceSettings PUT /service/{service_id}/version/{version_id}/settings Update service settings

GetServiceSettings

Get service settings

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.SettingsAPI.GetServiceSettings(ctx, serviceID, versionID).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `SettingsAPI.GetServiceSettings`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetServiceSettings`: SettingsResponse
    fmt.Fprintf(os.Stdout, "Response from `SettingsAPI.GetServiceSettings`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.

Other Parameters

Other parameters are passed through a pointer to a apiGetServiceSettingsRequest struct via the builder pattern

Name Type Description Notes

Return type

SettingsResponse

Authorization

API Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Back to top | Back to API list | Back to README

UpdateServiceSettings

Update service settings

Example

package main

import (
    "context"
    "fmt"
    "os"
    "github.com/fastly/fastly-go/fastly"
)

func main() {
    serviceID := "serviceId_example" // string | Alphanumeric string identifying the service.
    versionID := int32(56) // int32 | Integer identifying a service version.
    generalDefaultHost := "generalDefaultHost_example" // string | The default host name for the version. (optional)
    generalDefaultTTL := int32(56) // int32 | The default time-to-live (TTL) for the version. (optional)
    generalStaleIfError := true // bool | Enables serving a stale object if there is an error. (optional) (default to false)
    generalStaleIfErrorTTL := int32(56) // int32 | The default time-to-live (TTL) for serving the stale object for the version. (optional) (default to 43200)

    cfg := fastly.NewConfiguration()
    apiClient := fastly.NewAPIClient(cfg)
    ctx := fastly.NewAPIKeyContextFromEnv("FASTLY_API_TOKEN")
    resp, r, err := apiClient.SettingsAPI.UpdateServiceSettings(ctx, serviceID, versionID).GeneralDefaultHost(generalDefaultHost).GeneralDefaultTTL(generalDefaultTTL).GeneralStaleIfError(generalStaleIfError).GeneralStaleIfErrorTTL(generalStaleIfErrorTTL).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `SettingsAPI.UpdateServiceSettings`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `UpdateServiceSettings`: SettingsResponse
    fmt.Fprintf(os.Stdout, "Response from `SettingsAPI.UpdateServiceSettings`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceID string Alphanumeric string identifying the service.
versionID int32 Integer identifying a service version.

Other Parameters

Other parameters are passed through a pointer to a apiUpdateServiceSettingsRequest struct via the builder pattern

Name Type Description Notes
generalDefaultHost string The default host name for the version. generalDefaultTTL

Return type

SettingsResponse

Authorization

API Token

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded
  • Accept: application/json

Back to top | Back to API list | Back to README