This handler allows to directly download content denoted by a Drive entry ID or path. It is important to know that a CONTENT1) entry are download with their respective content type in their specific file format. Entries that are folders, such as: DRIVE, HOME, FOLDER can also be downloaded and will result in a ZIP file with the full structure of sub-entries. In addition, this handler can be used to upload and delete drive entries.
Note: The <Path ID>-part of the following methods can be determined using the metadata handler.
Request a download for the given <Path ID>. You can use either the Drive ID or the absolute path of the entry to download it. If <Path ID> is omitted, the request addresses the Drive root and downloads it as a ZIP file. Since there is no limit for the download of a folder structure, beware of the file size implications of the resulting download.
If the request was run successfully, you will receive the Drive entry content with status 200.
# Browser access http://127.0.0.1:9000/api/drive/content/path/to/item.txt # Shell access using curl curl -LsH "Authorization: Bearer <access_token>" "http://127.0.0.1:9000/api/drive/content/path/to/item.txt" # Shell access using curl using username and password curl -Lsu username:password "http://127.0.0.1:9000/api/drive/content/path/to/item.txt"
Using the PUT-method you can upload one file to the location denoted by the Drive ID or path. This operation accepts raw binary request bodies only, for example application/octet-stream. If the file already exists, it is updated when the user has the appropriate permissions. Multipart requests are not supported for PUT and result in status 415. Use POST for multipart uploads to folders.
Please note, that
If the request was run successfully, you will receive an empty response with status 200.
# Uploading a single file using curl curl --request "PUT" -LsH "Authorization: Bearer <access_token>" "http://127.0.0.1:9000/api/drive/content/path/to/item.txt" --data-binary "@path/to/item.txt" # Uploading a single file using curl using username and password curl --request "PUT"-Lsu username:password "http://127.0.0.1:9000/api/drive/content/path/to/item.txt" --data-binary "@path/to/item.txt"
Using the POST-method you can upload one or multiple files to the folder denoted by the Drive ID or path using multipart/form-data. The target is always treated as a folder. If a file already exists, it is updated when the user has the appropriate permissions. Missing folders are created and file names are taken from the multipart request. Raw binary request bodies are not supported for POST and result in status 415. Use PUT to upload or replace exactly one file.
If the request was run successfully, you will receive an empty response with status 200.
# Uploading a single file using curl curl --request "POST" -LsH "Authorization: Bearer <access_token>" -F "file=@file1.txt" "http://127.0.0.1:9000/api/drive/content/path/to/folder" # Uploading a single file using curl using username and password curl --request "POST" -Lsu username:password -F "file=@file1.txt" "http://127.0.0.1:9000/api/drive/content/path/to/folder" # Uploading a multiple file using curl curl --request "POST" -LsH "Authorization: Bearer <access_token>" -F "file=@file1.txt" -F "file=@file2.txt" "http://127.0.0.1:9000/api/drive/content/path/to/folder" # Uploading a multiple file using curl using username and password curl --request "POST" -Lsu username:password -F "file=@file1.txt" -F "file=@file2.txt" "http://127.0.0.1:9000/api/drive/content/path/to/folder"
Request to delete an entry denoted by the given <Path ID>. You can use either the Drive ID or the absolute path of the entry to delete it. Note, that if the Drive ID or path denotes a folder, the whole structure is being deleted without further notice.
If the request was run successfully, you will receive an empty response with status 200.
# Deleting a single file using curl curl --request "DELETE" -LsH "Authorization: Bearer <access_token>" "http://127.0.0.1:9000/api/drive/content/path/to/item.txt" # Deleting a single file using curl using username and password curl --request "DELETE"-Lsu username:password "http://127.0.0.1:9000/api/drive/content/path/to/item.txt"