assets
Creates, updates, deletes, gets or lists an assets resource.
Overview
| Name | assets |
| Type | Resource |
| Id | cloudflare.custom_pages.assets |
Fields
The following fields are returned by SELECT queries:
- get_by_account
- get_by_zone
- list_by_account
- list_by_zone
Get a custom asset response
| Name | Datatype | Description |
|---|---|---|
name | string | The unique name of the custom asset. Can only contain letters (A-Z, a-z), numbers (0-9), and underscores (_). (example: my_custom_error_page) |
description | string | A short description of the custom asset. (example: Custom 500 error page) |
last_updated | string (date-time) | (example: 2014-01-01T05:20:00.12345Z) |
size_bytes | integer | The size of the asset content in bytes. |
url | string (uri) | The URL where the asset content is fetched from. (example: https://example.com/error.html) |
Get a custom asset response
| Name | Datatype | Description |
|---|---|---|
name | string | The unique name of the custom asset. Can only contain letters (A-Z, a-z), numbers (0-9), and underscores (_). (example: my_custom_error_page) |
description | string | A short description of the custom asset. (example: Custom 500 error page) |
last_updated | string (date-time) | (example: 2014-01-01T05:20:00.12345Z) |
size_bytes | integer | The size of the asset content in bytes. |
url | string (uri) | The URL where the asset content is fetched from. (example: https://example.com/error.html) |
List custom assets response
| Name | Datatype | Description |
|---|---|---|
name | string | The unique name of the custom asset. Can only contain letters (A-Z, a-z), numbers (0-9), and underscores (_). (example: my_custom_error_page) |
description | string | A short description of the custom asset. (example: Custom 500 error page) |
last_updated | string (date-time) | (example: 2014-01-01T05:20:00.12345Z) |
size_bytes | integer | The size of the asset content in bytes. |
url | string (uri) | The URL where the asset content is fetched from. (example: https://example.com/error.html) |
List custom assets response
| Name | Datatype | Description |
|---|---|---|
name | string | The unique name of the custom asset. Can only contain letters (A-Z, a-z), numbers (0-9), and underscores (_). (example: my_custom_error_page) |
description | string | A short description of the custom asset. (example: Custom 500 error page) |
last_updated | string (date-time) | (example: 2014-01-01T05:20:00.12345Z) |
size_bytes | integer | The size of the asset content in bytes. |
url | string (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:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_by_account | select | asset_name, account_id | Fetches the details of a custom asset. | |
get_by_zone | select | asset_name, zone_id | Fetches the details of a custom asset. | |
list_by_account | select | account_id | page, per_page | Fetches all the custom assets. |
list_by_zone | select | zone_id | page, per_page | Fetches all the custom assets. |
create_by_account | insert | account_id, name, description, url | Creates a new custom asset. | |
create_by_zone | insert | zone_id, name, description, url | Creates a new custom asset. | |
update_by_account | replace | asset_name, account_id, description, url | Updates the configuration of an existing custom asset. | |
update_by_zone | replace | asset_name, zone_id, description, url | Updates the configuration of an existing custom asset. | |
delete_by_account | delete | asset_name, account_id | Deletes an existing custom asset. | |
delete_by_zone | delete | asset_name, zone_id | Deletes 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.
| Name | Datatype | Description |
|---|---|---|
account_id | string | The Cloudflare account ID. |
asset_name | string | |
zone_id | string | The Cloudflare zone ID. |
page | integer | |
per_page | integer |
SELECT examples
- get_by_account
- get_by_zone
- list_by_account
- list_by_zone
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
;
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 zone_id = '{{ zone_id }}' -- required
;
Fetches all the custom assets.
SELECT
name,
description,
last_updated,
size_bytes,
url
FROM cloudflare.custom_pages.assets
WHERE account_id = '{{ account_id }}' -- required
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
;
Fetches all the custom assets.
SELECT
name,
description,
last_updated,
size_bytes,
url
FROM cloudflare.custom_pages.assets
WHERE zone_id = '{{ zone_id }}' -- required
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
;
INSERT examples
- create_by_account
- create_by_zone
- Manifest
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
;
Creates a new custom asset.
INSERT INTO cloudflare.custom_pages.assets (
description,
name,
url,
zone_id
)
SELECT
'{{ description }}' /* required */,
'{{ name }}' /* required */,
'{{ url }}' /* required */,
'{{ zone_id }}'
RETURNING
errors,
messages,
result,
success
;
# Description fields are for documentation purposes
- name: assets
props:
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the assets resource.
- name: zone_id
value: "{{ zone_id }}"
description: Required parameter for the assets resource.
- name: description
value: "{{ description }}"
description: |
A short description of the custom asset.
- name: name
value: "{{ name }}"
description: |
The unique name of the custom asset. Can only contain letters (A-Z, a-z), numbers (0-9), and underscores (_).
- name: url
value: "{{ url }}"
description: |
The URL where the asset content is fetched from.
REPLACE examples
- update_by_account
- update_by_zone
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;
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 zone_id = '{{ zone_id }}' --required
AND description = '{{ description }}' --required
AND url = '{{ url }}' --required
RETURNING
errors,
messages,
result,
success;
DELETE examples
- delete_by_account
- delete_by_zone
Deletes an existing custom asset.
DELETE FROM cloudflare.custom_pages.assets
WHERE asset_name = '{{ asset_name }}' --required
AND account_id = '{{ account_id }}' --required
;
Deletes an existing custom asset.
DELETE FROM cloudflare.custom_pages.assets
WHERE asset_name = '{{ asset_name }}' --required
AND zone_id = '{{ zone_id }}' --required
;