Skip to main content

lists

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

Overview

Namelists
TypeResource
Idcloudflare.rules.lists

Fields

The following fields are returned by SELECT queries:

Get a list response.

NameDatatypeDescription
idstringThe unique ID of the list. (example: 2c0fc9fa937b11eaa1b71c4d701ab86e)
namestringAn informative name for the list. Use this name in filter and rule expressions. (example: list1)
created_onstringThe RFC 3339 timestamp of when the list was created. (example: 2020-01-01T08:00:00Z)
descriptionstringAn informative summary of the list. (example: This is a note)
kindstringThe type of the list. Each type supports specific list items (IP addresses, ASNs, hostnames or redirects). (ip, redirect, hostname, asn) (example: ip)
modified_onstringThe RFC 3339 timestamp of when the list was last modified. (example: 2020-01-10T14:00:00Z)
num_itemsnumberThe number of items in the list.
num_referencing_filtersnumberThe number of filters referencing the list.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectlist_id, account_idFetches the details of a list.
listselectaccount_idFetches all lists in the account.
createinsertaccount_id, name, kindCreates a new list of the specified kind.
updatereplacelist_id, account_idUpdates the description of a list.
deletedeletelist_id, account_idDeletes a specific list and all its items.

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.
list_idstring

SELECT examples

Fetches the details of a list.

SELECT
id,
name,
created_on,
description,
kind,
modified_on,
num_items,
num_referencing_filters
FROM cloudflare.rules.lists
WHERE list_id = '{{ list_id }}' -- required
AND account_id = '{{ account_id }}' -- required
;

INSERT examples

Creates a new list of the specified kind.

INSERT INTO cloudflare.rules.lists (
description,
kind,
name,
account_id
)
SELECT
'{{ description }}',
'{{ kind }}' /* required */,
'{{ name }}' /* required */,
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;

REPLACE examples

Updates the description of a list.

REPLACE cloudflare.rules.lists
SET
description = '{{ description }}'
WHERE
list_id = '{{ list_id }}' --required
AND account_id = '{{ account_id }}' --required
RETURNING
errors,
messages,
result,
success;

DELETE examples

Deletes a specific list and all its items.

DELETE FROM cloudflare.rules.lists
WHERE list_id = '{{ list_id }}' --required
AND account_id = '{{ account_id }}' --required
;