API: Files
This section explains how to manage files via the API, including listing, uploading, replacing, retrieving, downloading, and deleting files.
List Uploaded Files
Retrieve a list of all uploaded files. Use the "exclude-files-without-path" query parameter to exclude files that have no hosting path (default is false) and all files will be returned.
| GET /api/v1/files?exclude-files-without-path=false HTTP/1.1
Authorization: Bearer {JWT_TOKEN}
|
Upload a File
Upload a file to the server. If a file with the same hosting path exists, it will be replaced.
Request:
| POST /api/v1/files HTTP/1.1
Authorization: Bearer {JWT_TOKEN}
Content-Type: multipart/form-data; boundary=boundary
{FILE BEING UPLOADED IN MULTIPART}
|
Example:
| POST /api/v1/files HTTP/1.1
Authorization: Bearer {JWT_TOKEN}
Content-Type: multipart/form-data; boundary=boundary
--boundary
Content-Disposition: form-data; name="hosting/path/used.txt"; filename="original_filename.txt"
Hello world!
--boundary
|
Replace a File
Replace the content of an existing file by its ID.
Request:
| PUT /api/v1/file/{FILE-ID} HTTP/1.1
Authorization: Bearer {JWT_TOKEN}
Content-Type: multipart/form-data; boundary=boundary
{FILE BEING UPLOADED IN MULTIPART}
|
Example:
| PUT /api/v1/file/1d6bd4dc-f15a-452f-ac6d-db1413b3a581 HTTP/1.1
Authorization: Bearer {JWT_TOKEN}
Content-Type: multipart/form-data; boundary=boundary
--boundary
Content-Disposition: form-data; name="content"
New world!
--boundary
|
Retrieve file details either by its ID or by its hosting path.
By File ID:
| GET /api/v1/file/{FILE-ID} HTTP/1.1
Authorization: Bearer {JWT_TOKEN}
|
Example:
| GET /api/v1/file/94a0a77f-7c8b-4058-bd9c-57a03a223c52 HTTP/1.1
Authorization: Bearer {JWT_TOKEN}
|
By Hosting Path:
| GET /api/v1/file/by-path/{FILE-HOSTING-PATH} HTTP/1.1
Authorization: Bearer {JWT_TOKEN}
|
Example:
| GET /api/v1/file/by-path/hosting/path/used.txt HTTP/1.1
Authorization: Bearer {JWT_TOKEN}
|
Download a File
Download the contents of a file using its ID.
| GET /api/v1/file/{FILE-ID}/download HTTP/1.1
Authorization: Bearer {JWT_TOKEN}
|
Example:
| GET /api/v1/file/94a0a77f-7c8b-4058-bd9c-57a03a223c52/download HTTP/1.1
Authorization: Bearer {JWT_TOKEN}
|
Delete a File
Delete a file by its ID.
| DELETE /api/v1/file/{FILE-ID} HTTP/1.1
Authorization: Bearer {JWT_TOKEN}
|
Example:
| DELETE /api/v1/file/94a0a77f-7c8b-4058-bd9c-57a03a223c52 HTTP/1.1
Authorization: Bearer {JWT_TOKEN}
|