v1
Creates, updates, deletes, gets or lists a v1 resource.
Overview
| Name | v1 |
| Type | Resource |
| Id | cloudflare.images.v1 |
Fields
The following fields are returned by SELECT queries:
- get
- list
Image details response
| Name | Datatype | Description |
|---|---|---|
id | string | Image unique identifier. |
creator | string | Can set the creator field with an internal user ID. (example: 107b9558-dd06-4bbd-5fef-9c2c16bb7900) |
filename | string | Image file name. (example: logo.png) |
meta | object | User modifiable key-value store. Can be used for keeping references to another system of record for managing images. Metadata must not exceed 1024 bytes. |
requireSignedURLs | boolean | Indicates whether the image can be a accessed only using it's UID. If set to true, a signed token needs to be generated with a signing key to view the image. |
uploaded | string (date-time) | When the media item was uploaded. (example: 2014-01-02T02:20:00.123Z) |
variants | array | Object specifying available variants for an image. |
List images response
| Name | Datatype | Description |
|---|---|---|
id | string | Image unique identifier. |
creator | string | Can set the creator field with an internal user ID. (example: 107b9558-dd06-4bbd-5fef-9c2c16bb7900) |
filename | string | Image file name. (example: logo.png) |
meta | object | User modifiable key-value store. Can be used for keeping references to another system of record for managing images. Metadata must not exceed 1024 bytes. |
requireSignedURLs | boolean | Indicates whether the image can be a accessed only using it's UID. If set to true, a signed token needs to be generated with a signing key to view the image. |
uploaded | string (date-time) | When the media item was uploaded. (example: 2014-01-02T02:20:00.123Z) |
variants | array | Object specifying available variants for an image. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | image_id, account_id | Fetch details for a single image. | |
list | select | account_id | page, per_page, creator | List up to 100 images with one request. Use the optional parameters below to get a specific range of images. |
create | insert | account_id | Upload an image with up to 10 Megabytes using a single HTTP POST (multipart/form-data) request. An image can be uploaded by sending an image file or passing an accessible to an API url. | |
edit | update | image_id, account_id | Update image access control. On access control change, all copies of the image are purged from cache. | |
delete | delete | image_id, account_id | Delete an image on Cloudflare Images. On success, all copies of the image are deleted and purged from cache. |
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. |
image_id | string | |
creator | string | |
page | number | |
per_page | number |
SELECT examples
- get
- list
Fetch details for a single image.
SELECT
id,
creator,
filename,
meta,
requireSignedURLs,
uploaded,
variants
FROM cloudflare.images.v1
WHERE image_id = '{{ image_id }}' -- required
AND account_id = '{{ account_id }}' -- required
;
List up to 100 images with one request. Use the optional parameters below to get a specific range of images.
SELECT
id,
creator,
filename,
meta,
requireSignedURLs,
uploaded,
variants
FROM cloudflare.images.v1
WHERE account_id = '{{ account_id }}' -- required
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
AND creator = '{{ creator }}'
;
INSERT examples
- create
- Manifest
Upload an image with up to 10 Megabytes using a single HTTP POST (multipart/form-data) request. An image can be uploaded by sending an image file or passing an accessible to an API url.
INSERT INTO cloudflare.images.v1 (
creator,
file,
id,
metadata,
requireSignedURLs,
url,
account_id
)
SELECT
'{{ creator }}',
'{{ file }}',
'{{ id }}',
'{{ metadata }}',
{{ requireSignedURLs }},
'{{ url }}',
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;
# Description fields are for documentation purposes
- name: v1
props:
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the v1 resource.
- name: creator
value: "{{ creator }}"
description: |
Can set the creator field with an internal user ID.
- name: file
value: "{{ file }}"
description: |
An image binary data. Only needed when type is uploading a file.
- name: id
value: "{{ id }}"
description: |
An optional custom unique identifier for your image.
- name: metadata
value: "{{ metadata }}"
description: |
User modifiable key-value store. Can use used for keeping references to another system of record for managing images.
- name: requireSignedURLs
value: {{ requireSignedURLs }}
description: |
Indicates whether the image requires a signature token for the access.
default: false
- name: url
value: "{{ url }}"
description: |
A URL to fetch an image from origin. Only needed when type is uploading from a URL.
UPDATE examples
- edit
Update image access control. On access control change, all copies of the image are purged from cache.
UPDATE cloudflare.images.v1
SET
creator = '{{ creator }}',
metadata = '{{ metadata }}',
requireSignedURLs = {{ requireSignedURLs }}
WHERE
image_id = '{{ image_id }}' --required
AND account_id = '{{ account_id }}' --required
RETURNING
errors,
messages,
result,
success;
DELETE examples
- delete
Delete an image on Cloudflare Images. On success, all copies of the image are deleted and purged from cache.
DELETE FROM cloudflare.images.v1
WHERE image_id = '{{ image_id }}' --required
AND account_id = '{{ account_id }}' --required
;