Skip to main content

assets

Creates, updates, deletes, gets or lists an assets resource.

Overview

Nameassets
TypeResource
Idcloudflare.custom_pages.assets

Fields

The following fields are returned by SELECT queries:

Get a custom asset response

NameDatatypeDescription
namestringThe unique name of the custom asset. Can only contain letters (A-Z, a-z), numbers (0-9), and underscores (_). (example: my_custom_error_page)
descriptionstringA short description of the custom asset. (example: Custom 500 error page)
last_updatedstring (date-time) (example: 2014-01-01T05:20:00.12345Z)
size_bytesintegerThe size of the asset content in bytes.
urlstring (uri)The URL where the asset content is fetched from. (example: https://example.com/error.html)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_by_accountselectasset_name, account_idFetches the details of a custom asset.
get_by_zoneselectasset_name, zone_idFetches the details of a custom asset.
list_by_accountselectaccount_idpage, per_pageFetches all the custom assets.
list_by_zoneselectzone_idpage, per_pageFetches all the custom assets.
create_by_accountinsertaccount_id, name, description, urlCreates a new custom asset.
create_by_zoneinsertzone_id, name, description, urlCreates a new custom asset.
update_by_accountreplaceasset_name, account_id, description, urlUpdates the configuration of an existing custom asset.
update_by_zonereplaceasset_name, zone_id, description, urlUpdates the configuration of an existing custom asset.
delete_by_accountdeleteasset_name, account_idDeletes an existing custom asset.
delete_by_zonedeleteasset_name, zone_idDeletes an existing custom asset.

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
account_idstringThe Cloudflare account ID.
asset_namestring
zone_idstringThe Cloudflare zone ID.
pageinteger
per_pageinteger

SELECT examples

Fetches the details of a custom asset.

SELECT
name,
description,
last_updated,
size_bytes,
url
FROM cloudflare.custom_pages.assets
WHERE asset_name = '{{ asset_name }}' -- required
AND account_id = '{{ account_id }}' -- required
;

INSERT examples

Creates a new custom asset.

INSERT INTO cloudflare.custom_pages.assets (
description,
name,
url,
account_id
)
SELECT
'{{ description }}' /* required */,
'{{ name }}' /* required */,
'{{ url }}' /* required */,
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;

REPLACE examples

Updates the configuration of an existing custom asset.

REPLACE cloudflare.custom_pages.assets
SET
description = '{{ description }}',
url = '{{ url }}'
WHERE
asset_name = '{{ asset_name }}' --required
AND account_id = '{{ account_id }}' --required
AND description = '{{ description }}' --required
AND url = '{{ url }}' --required
RETURNING
errors,
messages,
result,
success;

DELETE examples

Deletes an existing custom asset.

DELETE FROM cloudflare.custom_pages.assets
WHERE asset_name = '{{ asset_name }}' --required
AND account_id = '{{ account_id }}' --required
;