Note
All URIs are relative to https://api.fastly.com
Method | HTTP request | Description |
---|---|---|
create_snippet | POST /service/{service_id}/version/{version_id}/snippet | Create a snippet |
delete_snippet | DELETE /service/{service_id}/version/{version_id}/snippet/{snippet_name} | Delete a snippet |
get_snippet | GET /service/{service_id}/version/{version_id}/snippet/{snippet_name} | Get a versioned snippet |
get_snippet_dynamic | GET /service/{service_id}/snippet/{snippet_id} | Get a dynamic snippet |
list_snippets | GET /service/{service_id}/version/{version_id}/snippet | List snippets |
update_snippet | PUT /service/{service_id}/version/{version_id}/snippet/{snippet_name} | Update a versioned snippet |
update_snippet_dynamic | PUT /service/{service_id}/snippet/{snippet_id} | Update a dynamic snippet |
SnippetResponsePost create_snippet(service_id, version_id)
Create a snippet
Create a snippet for a particular service and version.
- Api Key Authentication (token):
import time
import fastly
from fastly.api import snippet_api
from fastly.model.snippet_response_post import SnippetResponsePost
from pprint import pprint
# Defining the host is optional and defaults to https://api.fastly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = fastly.Configuration(
host = "https://api.fastly.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: token
configuration.api_key['token'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['token'] = 'Bearer'
# Enter a context with an instance of the API client
with fastly.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = snippet_api.SnippetApi(api_client)
service_id = "SU1Z0isxPaozGVKXdv0eY" # str | Alphanumeric string identifying the service.
version_id = 1 # int | Integer identifying a service version.
name = "test-snippet" # str | The name for the snippet. (optional)
type = "init" # str | The location in generated VCL where the snippet should be placed. (optional)
content = "content_example" # str | The VCL code that specifies exactly what the snippet does. (optional)
priority = "10" # str | Priority determines execution order. Lower numbers execute first. (optional) if omitted the server will use the default value of "100"
dynamic = "0" # str | Sets the snippet version. (optional)
# example passing only required values which don't have defaults set
try:
# Create a snippet
api_response = api_instance.create_snippet(service_id, version_id)
pprint(api_response)
except fastly.ApiException as e:
print("Exception when calling SnippetApi->create_snippet: %s\n" % e)
# example passing only required values which don't have defaults set
# and optional values
try:
# Create a snippet
api_response = api_instance.create_snippet(service_id, version_id, name=name, type=type, content=content, priority=priority, dynamic=dynamic)
pprint(api_response)
except fastly.ApiException as e:
print("Exception when calling SnippetApi->create_snippet: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
service_id | str | Alphanumeric string identifying the service. | |
version_id | int | Integer identifying a service version. | |
name | str | The name for the snippet. | [optional] |
type | str | The location in generated VCL where the snippet should be placed. | [optional] |
content | str | The VCL code that specifies exactly what the snippet does. | [optional] |
priority | str | Priority determines execution order. Lower numbers execute first. | [optional] if omitted the server will use the default value of "100" |
dynamic | str | Sets the snippet version. | [optional] |
- Content-Type: application/x-www-form-urlencoded
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | OK | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
InlineResponse200 delete_snippet(service_id, version_id, snippet_name)
Delete a snippet
Delete a specific snippet for a particular service and version.
- Api Key Authentication (token):
import time
import fastly
from fastly.api import snippet_api
from fastly.model.inline_response200 import InlineResponse200
from pprint import pprint
# Defining the host is optional and defaults to https://api.fastly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = fastly.Configuration(
host = "https://api.fastly.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: token
configuration.api_key['token'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['token'] = 'Bearer'
# Enter a context with an instance of the API client
with fastly.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = snippet_api.SnippetApi(api_client)
service_id = "SU1Z0isxPaozGVKXdv0eY" # str | Alphanumeric string identifying the service.
version_id = 1 # int | Integer identifying a service version.
snippet_name = "test-snippet" # str | The name for the snippet.
# example passing only required values which don't have defaults set
try:
# Delete a snippet
api_response = api_instance.delete_snippet(service_id, version_id, snippet_name)
pprint(api_response)
except fastly.ApiException as e:
print("Exception when calling SnippetApi->delete_snippet: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
service_id | str | Alphanumeric string identifying the service. | |
version_id | int | Integer identifying a service version. | |
snippet_name | str | The name for the snippet. |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | OK | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
SnippetResponse get_snippet(service_id, version_id, snippet_name)
Get a versioned snippet
Get a single snippet for a particular service and version.
- Api Key Authentication (token):
import time
import fastly
from fastly.api import snippet_api
from fastly.model.snippet_response import SnippetResponse
from pprint import pprint
# Defining the host is optional and defaults to https://api.fastly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = fastly.Configuration(
host = "https://api.fastly.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: token
configuration.api_key['token'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['token'] = 'Bearer'
# Enter a context with an instance of the API client
with fastly.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = snippet_api.SnippetApi(api_client)
service_id = "SU1Z0isxPaozGVKXdv0eY" # str | Alphanumeric string identifying the service.
version_id = 1 # int | Integer identifying a service version.
snippet_name = "test-snippet" # str | The name for the snippet.
# example passing only required values which don't have defaults set
try:
# Get a versioned snippet
api_response = api_instance.get_snippet(service_id, version_id, snippet_name)
pprint(api_response)
except fastly.ApiException as e:
print("Exception when calling SnippetApi->get_snippet: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
service_id | str | Alphanumeric string identifying the service. | |
version_id | int | Integer identifying a service version. | |
snippet_name | str | The name for the snippet. |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | OK | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
SnippetResponse get_snippet_dynamic(service_id, snippet_id)
Get a dynamic snippet
Get a single dynamic snippet for a particular service.
- Api Key Authentication (token):
import time
import fastly
from fastly.api import snippet_api
from fastly.model.snippet_response import SnippetResponse
from pprint import pprint
# Defining the host is optional and defaults to https://api.fastly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = fastly.Configuration(
host = "https://api.fastly.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: token
configuration.api_key['token'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['token'] = 'Bearer'
# Enter a context with an instance of the API client
with fastly.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = snippet_api.SnippetApi(api_client)
service_id = "SU1Z0isxPaozGVKXdv0eY" # str | Alphanumeric string identifying the service.
snippet_id = "62Yd1WfiCBPENLloXfXmlO" # str | Alphanumeric string identifying a VCL Snippet.
# example passing only required values which don't have defaults set
try:
# Get a dynamic snippet
api_response = api_instance.get_snippet_dynamic(service_id, snippet_id)
pprint(api_response)
except fastly.ApiException as e:
print("Exception when calling SnippetApi->get_snippet_dynamic: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
service_id | str | Alphanumeric string identifying the service. | |
snippet_id | str | Alphanumeric string identifying a VCL Snippet. |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | OK | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[SnippetResponse] list_snippets(service_id, version_id)
List snippets
List all snippets for a particular service and version.
- Api Key Authentication (token):
import time
import fastly
from fastly.api import snippet_api
from fastly.model.snippet_response import SnippetResponse
from pprint import pprint
# Defining the host is optional and defaults to https://api.fastly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = fastly.Configuration(
host = "https://api.fastly.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: token
configuration.api_key['token'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['token'] = 'Bearer'
# Enter a context with an instance of the API client
with fastly.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = snippet_api.SnippetApi(api_client)
service_id = "SU1Z0isxPaozGVKXdv0eY" # str | Alphanumeric string identifying the service.
version_id = 1 # int | Integer identifying a service version.
# example passing only required values which don't have defaults set
try:
# List snippets
api_response = api_instance.list_snippets(service_id, version_id)
pprint(api_response)
except fastly.ApiException as e:
print("Exception when calling SnippetApi->list_snippets: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
service_id | str | Alphanumeric string identifying the service. | |
version_id | int | Integer identifying a service version. |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | OK | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
SnippetResponse update_snippet(service_id, version_id, snippet_name)
Update a versioned snippet
Update a specific snippet for a particular service and version.
- Api Key Authentication (token):
import time
import fastly
from fastly.api import snippet_api
from fastly.model.snippet_response import SnippetResponse
from pprint import pprint
# Defining the host is optional and defaults to https://api.fastly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = fastly.Configuration(
host = "https://api.fastly.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: token
configuration.api_key['token'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['token'] = 'Bearer'
# Enter a context with an instance of the API client
with fastly.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = snippet_api.SnippetApi(api_client)
service_id = "SU1Z0isxPaozGVKXdv0eY" # str | Alphanumeric string identifying the service.
version_id = 1 # int | Integer identifying a service version.
snippet_name = "test-snippet" # str | The name for the snippet.
# example passing only required values which don't have defaults set
try:
# Update a versioned snippet
api_response = api_instance.update_snippet(service_id, version_id, snippet_name)
pprint(api_response)
except fastly.ApiException as e:
print("Exception when calling SnippetApi->update_snippet: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
service_id | str | Alphanumeric string identifying the service. | |
version_id | int | Integer identifying a service version. | |
snippet_name | str | The name for the snippet. |
- Content-Type: application/x-www-form-urlencoded
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | OK | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
SnippetResponse update_snippet_dynamic(service_id, snippet_id)
Update a dynamic snippet
Update a dynamic snippet for a particular service.
- Api Key Authentication (token):
import time
import fastly
from fastly.api import snippet_api
from fastly.model.snippet_response import SnippetResponse
from pprint import pprint
# Defining the host is optional and defaults to https://api.fastly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = fastly.Configuration(
host = "https://api.fastly.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure API key authorization: token
configuration.api_key['token'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['token'] = 'Bearer'
# Enter a context with an instance of the API client
with fastly.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = snippet_api.SnippetApi(api_client)
service_id = "SU1Z0isxPaozGVKXdv0eY" # str | Alphanumeric string identifying the service.
snippet_id = "62Yd1WfiCBPENLloXfXmlO" # str | Alphanumeric string identifying a VCL Snippet.
name = "test-snippet" # str | The name for the snippet. (optional)
type = "init" # str | The location in generated VCL where the snippet should be placed. (optional)
content = "content_example" # str | The VCL code that specifies exactly what the snippet does. (optional)
priority = "10" # str | Priority determines execution order. Lower numbers execute first. (optional) if omitted the server will use the default value of "100"
dynamic = "0" # str | Sets the snippet version. (optional)
# example passing only required values which don't have defaults set
try:
# Update a dynamic snippet
api_response = api_instance.update_snippet_dynamic(service_id, snippet_id)
pprint(api_response)
except fastly.ApiException as e:
print("Exception when calling SnippetApi->update_snippet_dynamic: %s\n" % e)
# example passing only required values which don't have defaults set
# and optional values
try:
# Update a dynamic snippet
api_response = api_instance.update_snippet_dynamic(service_id, snippet_id, name=name, type=type, content=content, priority=priority, dynamic=dynamic)
pprint(api_response)
except fastly.ApiException as e:
print("Exception when calling SnippetApi->update_snippet_dynamic: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
service_id | str | Alphanumeric string identifying the service. | |
snippet_id | str | Alphanumeric string identifying a VCL Snippet. | |
name | str | The name for the snippet. | [optional] |
type | str | The location in generated VCL where the snippet should be placed. | [optional] |
content | str | The VCL code that specifies exactly what the snippet does. | [optional] |
priority | str | Priority determines execution order. Lower numbers execute first. | [optional] if omitted the server will use the default value of "100" |
dynamic | str | Sets the snippet version. | [optional] |
- Content-Type: application/x-www-form-urlencoded
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | OK | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]