Skip to main content

variants

Creates, updates, deletes, gets or lists a variants resource.

Overview​

Namevariants
TypeResource
Idcloudflare.cache.variants

Fields​

The following fields are returned by SELECT queries:

Get variants setting response.

NameDatatypeDescription
idstringThe identifier of the caching setting. (variants)
editablebooleanWhether the setting is editable.
modified_onstring (date-time)Last time this setting was modified.
valueobjectValue of the zone setting.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectzone_idVariant 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.
editupdatezone_id, valueVariant 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.
deletedeletezone_idVariant 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.

NameDatatypeDescription
zone_idstringThe Cloudflare zone ID.

SELECT examples​

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​

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​

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
;