Skip to main content

items

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

Overview

Nameitems
TypeResource
Idcloudflare.rules.items

Fields

The following fields are returned by SELECT queries:

Get a list item response.

NameDatatypeDescription
idstringDefines the unique ID of the item in the List. (example: 34b12448945f11eaa1b71c4d701ab86e)
asnintegerDefines a non-negative 32 bit integer.
commentstringDefines an informative summary of the list item. (example: Private IP address)
created_onstringThe RFC 3339 timestamp of when the list was created. (example: 2020-01-01T08:00:00Z)
hostnameobjectValid characters for hostnames are ASCII(7) letters from a to z, the digits from 0 to 9, wildcards (*), and the hyphen (-).
ipstringAn IPv4 address, an IPv4 CIDR, an IPv6 address, or an IPv6 CIDR. (example: 10.0.0.1)
modified_onstringThe RFC 3339 timestamp of when the list was last modified. (example: 2020-01-10T14:00:00Z)
redirectobjectThe definition of the redirect.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectitem_id, list_id, account_idFetches a list item in the list.
listselectlist_id, account_idcursor, per_page, searchFetches all the items in the list.
createinsertlist_id, account_idAppends new items to the list. This operation is asynchronous. To get current the operation status, invoke the Get bulk operation status endpoint with the returned operation_id. There is a limit of 1 pending bulk operation per account. If an outstanding bulk operation is in progress, the request will be rejected.
updatereplacelist_id, account_idRemoves all existing items from the list and adds the provided items to the list. This operation is asynchronous. To get current the operation status, invoke the Get bulk operation status endpoint with the returned operation_id. There is a limit of 1 pending bulk operation per account. If an outstanding bulk operation is in progress, the request will be rejected.
deletedeletelist_id, account_idRemoves one or more items from a list. This operation is asynchronous. To get current the operation status, invoke the Get bulk operation status endpoint with the returned operation_id. There is a limit of 1 pending bulk operation per account. If an outstanding bulk operation is in progress, the request will be rejected.

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.
item_idstring
list_idstring
cursorstring
per_pageinteger

SELECT examples

Fetches a list item in the list.

SELECT
id,
asn,
comment,
created_on,
hostname,
ip,
modified_on,
redirect
FROM cloudflare.rules.items
WHERE item_id = '{{ item_id }}' -- required
AND list_id = '{{ list_id }}' -- required
AND account_id = '{{ account_id }}' -- required
;

INSERT examples

Appends new items to the list. This operation is asynchronous. To get current the operation status, invoke the Get bulk operation status endpoint with the returned operation_id. There is a limit of 1 pending bulk operation per account. If an outstanding bulk operation is in progress, the request will be rejected.

INSERT INTO cloudflare.rules.items (
list_id,
account_id
)
SELECT
'{{ list_id }}',
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;

REPLACE examples

Removes all existing items from the list and adds the provided items to the list. This operation is asynchronous. To get current the operation status, invoke the Get bulk operation status endpoint with the returned operation_id. There is a limit of 1 pending bulk operation per account. If an outstanding bulk operation is in progress, the request will be rejected.

REPLACE cloudflare.rules.items
SET
-- No updatable properties
WHERE
list_id = '{{ list_id }}' --required
AND account_id = '{{ account_id }}' --required
RETURNING
errors,
messages,
result,
success;

DELETE examples

Removes one or more items from a list. This operation is asynchronous. To get current the operation status, invoke the Get bulk operation status endpoint with the returned operation_id. There is a limit of 1 pending bulk operation per account. If an outstanding bulk operation is in progress, the request will be rejected.

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