variants
Creates, updates, deletes, gets or lists a variants resource.
Overview
| Name | variants |
| Type | Resource |
| Id | cloudflare.cache.variants |
Fields
The following fields are returned by SELECT queries:
- list
Get variants setting response.
| Name | Datatype | Description |
|---|---|---|
id | string | The identifier of the caching setting. (variants) |
editable | boolean | Whether the setting is editable. |
modified_on | string (date-time) | Last time this setting was modified. |
value | object | Value of the zone setting. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | zone_id | Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but does not serve the variant requested, the response will not be cached. This will be indicated with BYPASS cache status in the response headers. | |
edit | update | zone_id, value | Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but does not serve the variant requested, the response will not be cached. This will be indicated with BYPASS cache status in the response headers. | |
delete | delete | zone_id | Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but does not serve the variant requested, the response will not be cached. This will be indicated with BYPASS cache status in the response headers. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
zone_id | string | The Cloudflare zone ID. |
SELECT examples
- list
Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but does not serve the variant requested, the response will not be cached. This will be indicated with BYPASS cache status in the response headers.
SELECT
id,
editable,
modified_on,
value
FROM cloudflare.cache.variants
WHERE zone_id = '{{ zone_id }}' -- required
;
UPDATE examples
- edit
Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but does not serve the variant requested, the response will not be cached. This will be indicated with BYPASS cache status in the response headers.
UPDATE cloudflare.cache.variants
SET
value = '{{ value }}'
WHERE
zone_id = '{{ zone_id }}' --required
AND value = '{{ value }}' --required
RETURNING
errors,
messages,
result,
success;
DELETE examples
- delete
Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but does not serve the variant requested, the response will not be cached. This will be indicated with BYPASS cache status in the response headers.
DELETE FROM cloudflare.cache.variants
WHERE zone_id = '{{ zone_id }}' --required
;