content
Creates, updates, deletes, gets or lists a content resource.
Overview
| Name | content |
| Type | Resource |
| Id | cloudflare.workers_for_platforms.content |
Fields
The following fields are returned by SELECT queries:
- list
Get script content.
| Name | Datatype | Description |
|---|---|---|
contents | string |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | account_id, dispatch_namespace, script_name | Fetch script content from a script uploaded to a Workers for Platforms namespace. | |
update | replace | account_id, dispatch_namespace, script_name, metadata | CF-WORKER-BODY-PART, CF-WORKER-MAIN-MODULE-PART | Put script content for a script uploaded to a Workers for Platforms namespace. |
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. |
dispatch_namespace | string | The Workers-for-Platforms dispatch namespace. |
script_name | string | The Worker script name. |
CF-WORKER-BODY-PART | string | The multipart name of a script upload part containing script content in service worker format. Alternative to including in a metadata part. |
CF-WORKER-MAIN-MODULE-PART | string | The multipart name of a script upload part containing script content in es module format. Alternative to including in a metadata part. |
SELECT examples
- list
Fetch script content from a script uploaded to a Workers for Platforms namespace.
SELECT
contents
FROM cloudflare.workers_for_platforms.content
WHERE account_id = '{{ account_id }}' -- required
AND dispatch_namespace = '{{ dispatch_namespace }}' -- required
AND script_name = '{{ script_name }}' -- required
;
REPLACE examples
- update
Put script content for a script uploaded to a Workers for Platforms namespace.
REPLACE cloudflare.workers_for_platforms.content
SET
files = '{{ files }}',
metadata = '{{ metadata }}'
WHERE
account_id = '{{ account_id }}' --required
AND dispatch_namespace = '{{ dispatch_namespace }}' --required
AND script_name = '{{ script_name }}' --required
AND metadata = '{{ metadata }}' --required
AND CF-WORKER-BODY-PART = '{{ CF-WORKER-BODY-PART}}'
AND CF-WORKER-MAIN-MODULE-PART = '{{ CF-WORKER-MAIN-MODULE-PART}}'
RETURNING
errors,
messages,
result,
success;