Skip to main content

downloads

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

Overview

Namedownloads
TypeResource
Idcloudflare.streams.downloads

Fields

The following fields are returned by SELECT queries:

List downloads response.

NameDatatypeDescription
audioobjectThe audio-only download. Only present if this download type has been created.
defaultobjectThe default video download. Only present if this download type has been created.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectidentifier, account_idLists the downloads created for a video.
stream_downloads_create_type_specific_downloadsinsertidentifier, account_id, download_typeCreates a download for a video of specified type. For backwards-compatibility, POST requests to /downloads will enable the default download.
createinsertidentifier, account_idCreates a download for a video when a video is ready to view. Use /downloads/{download_type} instead for type-specific downloads. Available types are default and audio.
stream_downloads_delete_type_specific_downloadsdeleteidentifier, account_id, download_typeDelete specific type of download. For backwards-compatibility, DELETE requests to /downloads will delete the default download.
deletedeleteidentifier, account_idDelete the downloads for a video. Use /downloads/{download_type} instead for type-specific downloads. Available types are default and audio.

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.
download_typestring
identifierstringResource identifier.

SELECT examples

Lists the downloads created for a video.

SELECT
audio,
default
FROM cloudflare.streams.downloads
WHERE identifier = '{{ identifier }}' -- required
AND account_id = '{{ account_id }}' -- required
;

INSERT examples

Creates a download for a video of specified type. For backwards-compatibility, POST requests to /downloads will enable the default download.

INSERT INTO cloudflare.streams.downloads (
identifier,
account_id,
download_type
)
SELECT
'{{ identifier }}',
'{{ account_id }}',
'{{ download_type }}'
RETURNING
errors,
messages,
result,
success
;

DELETE examples

Delete specific type of download. For backwards-compatibility, DELETE requests to /downloads will delete the default download.

DELETE FROM cloudflare.streams.downloads
WHERE identifier = '{{ identifier }}' --required
AND account_id = '{{ account_id }}' --required
AND download_type = '{{ download_type }}' --required
;