subscriptions
Creates, updates, deletes, gets or lists a subscriptions resource.
Overview
| Name | subscriptions |
| Type | Resource |
| Id | cloudflare.queues.subscriptions |
Fields
The following fields are returned by SELECT queries:
- get
- list
Details about an event subscription
| Name | Datatype | Description |
|---|---|---|
id | string | Unique identifier for the subscription |
name | string | Name of the subscription |
created_at | string (date-time) | When the subscription was created |
destination | object | Destination configuration for the subscription |
enabled | boolean | Whether the subscription is active |
events | array | List of event types this subscription handles |
modified_at | string (date-time) | When the subscription was last modified |
source | object | Source configuration for the subscription |
List of event subscriptions
| Name | Datatype | Description |
|---|---|---|
id | string | Unique identifier for the subscription |
name | string | Name of the subscription |
created_at | string (date-time) | When the subscription was created |
destination | object | Destination configuration for the subscription |
enabled | boolean | Whether the subscription is active |
events | array | List of event types this subscription handles |
modified_at | string (date-time) | When the subscription was last modified |
source | object | Source configuration for the subscription |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | account_id, subscription_id | Get details about an existing event subscription | |
list | select | account_id | page, per_page, order, direction | Get a paginated list of event subscriptions with optional sorting and filtering |
create | insert | account_id | Create a new event subscription for a queue | |
update | update | account_id, subscription_id | Update an existing event subscription | |
delete | delete | account_id, subscription_id | Delete an existing event subscription |
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. |
subscription_id | string | The subscription ID. |
direction | string | Sort direction |
order | string | Field to sort by |
page | integer | Page number for pagination |
per_page | integer | Number of items per page |
SELECT examples
- get
- list
Get details about an existing event subscription
SELECT
id,
name,
created_at,
destination,
enabled,
events,
modified_at,
source
FROM cloudflare.queues.subscriptions
WHERE account_id = '{{ account_id }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;
Get a paginated list of event subscriptions with optional sorting and filtering
SELECT
id,
name,
created_at,
destination,
enabled,
events,
modified_at,
source
FROM cloudflare.queues.subscriptions
WHERE account_id = '{{ account_id }}' -- required
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
AND order = '{{ order }}'
AND direction = '{{ direction }}'
;
INSERT examples
- create
- Manifest
Create a new event subscription for a queue
INSERT INTO cloudflare.queues.subscriptions (
destination,
enabled,
events,
name,
source,
account_id
)
SELECT
'{{ destination }}',
{{ enabled }},
'{{ events }}',
'{{ name }}',
'{{ source }}',
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;
# Description fields are for documentation purposes
- name: subscriptions
props:
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the subscriptions resource.
- name: destination
description: |
Destination configuration for the subscription
value:
queue_id: "{{ queue_id }}"
type: "{{ type }}"
- name: enabled
value: {{ enabled }}
description: |
Whether the subscription is active
- name: events
value:
- "{{ events }}"
description: |
List of event types this subscription handles
- name: name
value: "{{ name }}"
description: |
Name of the subscription
- name: source
description: |
Source configuration for the subscription
value:
type: "{{ type }}"
model_name: "{{ model_name }}"
worker_name: "{{ worker_name }}"
workflow_name: "{{ workflow_name }}"
UPDATE examples
- update
Update an existing event subscription
UPDATE cloudflare.queues.subscriptions
SET
destination = '{{ destination }}',
enabled = {{ enabled }},
events = '{{ events }}',
name = '{{ name }}'
WHERE
account_id = '{{ account_id }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
errors,
messages,
result,
success;
DELETE examples
- delete
Delete an existing event subscription
DELETE FROM cloudflare.queues.subscriptions
WHERE account_id = '{{ account_id }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;