Skip to main content

labels

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

Overview

Namelabels
TypeResource
Idcloudflare.api_gateway.labels

Fields

The following fields are returned by SELECT queries:

Retrieve all labels response

NameDatatypeDescription
namestringThe name of the label (example: login)
created_atstring (date-time) (example: 2014-01-01T05:20:00.12345Z)
descriptionstringThe description of the label (example: All endpoints that deal with logins)
last_updatedstring (date-time) (example: 2014-01-01T05:20:00.12345Z)
mapped_resourcesobjectProvides counts of what resources are linked to this label
metadataobjectMetadata for the label
sourcestring* user - label is owned by the user * managed - label is owned by cloudflare (user, managed)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectzone_idpage, per_page, order, direction, source, filter, with_mapped_resource_countsRetrieve all labels
createinsertzone_id, operation_idAttach label(s) on an operation in endpoint management
api_shield_operations_bulk_post_labels_to_operationsinsertzone_id, selectorBulk attach label(s) on operation(s) in endpoint management
updatereplacezone_id, operation_idReplace label(s) on an operation in endpoint management
api_shield_operations_bulk_put_labels_to_operationsreplacezone_id, selector, user, managedBulk replace label(s) on operation(s) in endpoint management
deletedeletezone_id, operation_idRemove label(s) on an operation in endpoint management
api_shield_operations_bulk_delete_labels_to_operationsdeletezone_idBulk remove label(s) on operation(s) in endpoint management

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
operation_idstringIdentifier for the operation
zone_idstringThe Cloudflare zone ID.
directionstring
filterstringFilter for labels where the name or description matches using substring match
orderstring
pageintegerPage number of paginated results.
per_pageintegerMaximum number of results per page.
sourcestringFilter for labels with source
with_mapped_resource_countsbooleanInclude mapped_resources for each label

SELECT examples

Retrieve all labels

SELECT
name,
created_at,
description,
last_updated,
mapped_resources,
metadata,
source
FROM cloudflare.api_gateway.labels
WHERE zone_id = '{{ zone_id }}' -- required
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
AND order = '{{ order }}'
AND direction = '{{ direction }}'
AND source = '{{ source }}'
AND filter = '{{ filter }}'
AND with_mapped_resource_counts = '{{ with_mapped_resource_counts }}'
;

INSERT examples

Attach label(s) on an operation in endpoint management

INSERT INTO cloudflare.api_gateway.labels (
managed,
user,
zone_id,
operation_id
)
SELECT
'{{ managed }}',
'{{ user }}',
'{{ zone_id }}',
'{{ operation_id }}'
RETURNING
errors,
messages,
result,
success
;

REPLACE examples

Replace label(s) on an operation in endpoint management

REPLACE cloudflare.api_gateway.labels
SET
managed = '{{ managed }}',
user = '{{ user }}'
WHERE
zone_id = '{{ zone_id }}' --required
AND operation_id = '{{ operation_id }}' --required
RETURNING
errors,
messages,
result,
success;

DELETE examples

Remove label(s) on an operation in endpoint management

DELETE FROM cloudflare.api_gateway.labels
WHERE zone_id = '{{ zone_id }}' --required
AND operation_id = '{{ operation_id }}' --required
;