Drive Item Content
This handler allows to directly download content denoted by a Drive entry ID or path. It is important to know that a CONTENT
1) 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.
GET /api/drive/content/<Path ID>
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. 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.
Application Example
# 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"
PUT /api/drive/content/<Path ID>
Using the PUT
-method you can upload one file to the location denoted by the Drive ID or path. If the file already exists, it is updated when the user has the appropriate permissions.
Please note, that
-
when sending data to a file denoted by a path, it must also specify the file name. Missing path items in between are created if they do not yet exist.
-
when sending data to a file denoted by a Drive ID in the request, it is required that this file already exists, and it will be updated.
If the request was run successfully, you will receive an empty response with status 200.
Application Example
# 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"
POST /api/drive/content/<Path ID>
Using the POST
-method you can upload one or multiple files to the location denoted by the Drive ID or path using multipart/form-data
. 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.
If the request was run successfully, you will receive an empty response with status 200.
Application Example
# Uploading a single file using curl
curl -LsH "Authorization: Bearer <access_token>" --upload-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 -Lsu username:password --upload-file "file1.txt" "http://127.0.0.1:9000/api/drive/content/path/to/folder"
# Uploading a multiple file using curl
curl -LsH "Authorization: Bearer <access_token>" --upload-file "{file1.txt,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 -Lsu username:password --upload-file "{file1.txt,file2.txt}" "http://127.0.0.1:9000/api/drive/content/path/to/folder"
DELETE /api/drive/content/<Path ID>
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.
Application Example
# 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"