Media

Download a file from a URL into a media directory.

Changed on

Checks the URL and waits for the remote server's response headers, then answers 202 with the job while the body downloads in the background. Progress and the outcome arrive as MediaDownloadProgress WebSocket events.

post/api/media/download

Request

  • The document declares no server URL.
  • Auth
    none declared

Request body

filenamestring nullable

File name to save as. When absent, the name comes from the response's Content-Disposition header, then from the URL's last path segment. At most 200 bytes.

overwriteboolean

Replace an existing file of the same name. Without it, an existing file makes the request fail with 409 Conflict.

pathstring

Directory to save into, relative to the media root. Empty means the root.

urlstring required

The http or https URL to fetch.

Response

Download started

bytesinteger required

Bytes received so far.

directorystring required

Directory the file is saved into, relative to the media root.

errorstring nullable

Why the download failed, when it did.

filenamestring required

File name the download is saved as.

job_idstring required

Job identifier, used to cancel the download.

pathstring required

Path of the finished file, relative to the media root.

state'downloading' | 'done' | 'failed' | 'cancelled' required

Where a URL download is in its life.

totalinteger nullable

Total size, when the server announced one.

urlstring required

The requested URL without user info, query or fragment, for display.

Changes