Files#
These Methods allows for file management
GET: /files/<path>, defaults={“path”: “”}
Get a list of all the files and folders for <path>
- parameters:
path (string) - Path to folder
- headers:
- x-api-key (string)UUID (string)reverse (“True” or “False”) - (Optional, default: “False”) - reverse sortsortBy (“name”, “size”, “lastModified”, “extension”, “type”, “random”) - (Optional, default: “name”) - sort bysizeBytes (“True” or “False”) - (Optional, default: “False”) - return filesize in bytes
Return Example:
{"codes": [200], "data": { "back": "home" "path": "home/images" "files": [ { "encrypted": "6af137afb25bbe0c2a9f25f48f7722cac97c84aaac63de963af5b0d502fc97c5.jpg", "fileSize": "75.2 kB", "fileSizeBytes": 75245, "isFolder": "False", "lastModified": "02.04.2022 19:52", "name": "image.jpg", "path": "home/images", "thumbnail": "https://martensen.dev/api/f/thumbnail/home/images/6af137afb25bbe0c2a9f25f48f7722cac97c84aaac63de963af5b0d502fc97c5.jpg" }, ... ] }}
GET: /file/<path>, defaults={“path”: “”}
Get a file for <path>
- parameters:
path (string) - Path to file
- headers:
- x-api-key (string)UUID (string)
Return Example:
file
GET: /f/info/<path>, defaults={“path”: “”}
Get file information, depending on filetype some paramters might be empty
- parameters:
path (string) - Path to file
- headers:
- x-api-key (string)UUID (string)
Return Example:
{"codes": [200], "data": { "aspect_ratio": "9:16", "bitDepth": "", "bitrate": 1838855.0, "codec": "h264", "duration": 17.89, "encrypted": "5af90c5f4cef0517f2a00db4ba8703a10d7a4df81234b57b3a16d71b49a87bcd.mp4", "extension": "mp4", "fileSize": "4.4 MB", "framerate": 29.97, "height": 1136.0, "isFolder": "False", "lastModified": "02.04.2022 20:22", "name": "video.mp4", "path": "home/videos", "thumbnail": "https://martensen.dev/api/f/thumbnail/home/videos/5af90c5f4cef0517f2a00db4ba8703a10d7a4df81234b57b3a16d71b49a87bcd.mp4", "type": "video", "width": 640.0 } }}
GET: /f/thumbnail/<path>, defaults={“path”: “”}
Get the thumbnail. Works for most image and video extensions
- parameters:
path (string) - Path to file
- headers:
- x-api-key (string)UUID (string)keepAspect (“True” or “False”) - (Optional) - keep aspect ratio of original image. Otherwise use 1:1 aspectsize (int[32-512]) - (Optional) - Thumbnail size in pixels
Return Example:
thumbnail
POST: /f/rename/<path>, defaults={“path”: “”}
Rename a file or folder in <path>
- parameters:
path (string) - Path to folder
- headers:
- x-api-key (string)UUID (string)encrypted (string) - encrypted filename (from /files)name (string) - New file/folder name
Return Example:
{"codes": [200]}
GET: /f/search/<path>, defaults={“path”: “”}
Search for a file or folder in <path>
- parameters:
path (string) - Path to folder
- headers:
- x-api-key (string)UUID (string)search (string) - search stringsubFolders (“True” or “False”) - search in subdirectoriesreverse (“True” or “False”) - (Optional, default: “False”) - reverse sortsortBy (“name”, “size”, “lastModified”, “extension”, “type”, “random”) - (Optional, default: “name”) - sort bysizeBytes (“True” or “False”) - (Optional, default: “False”) - return filesize in bytes
Return Example:
{"codes": [200], "data": [ { "encrypted": "6af137afb25bbe0c2a9f25f48f7722cac97c84aaac63de963af5b0d502fc97c5.jpg", "fileSize": "75.2 kB", "isFolder": "False", "lastModified": "02.04.2022 19:52", "name": "image.jpg", "path": "home/images", "thumbnail": "https://martensen.dev/api/f/thumbnail/home/images/6af137afb25bbe0c2a9f25f48f7722cac97c84aaac63de963af5b0d502fc97c5.jpg" }, ... ] }
POST: /f/upload/<path>, defaults={“path”: “”}
Upload files or add a folder
- parameters:
path (string) - Path to folder
- headers:
- x-api-key (string)UUID (string)folder (string) - (Optional) - instead of file add a new folder
- files:
Allows multi-file uploads
- limits:
- A maximum of 5GB per request is allowed.If the file would make the account go over the limit, the file will not be uploaded.
Return Example:
{"codes": [200], "data": { "encrypted": "d9e3c4ca72bbd3ec819d656b4f60261e0ebed7e0db7870203ba1aee9d5823154.png", "fileSize": "21.7 kB", "isFolder": "False", "lastModified": "27.08.2022 20:22", "name": "icon.png", "path": "1testing", "thumbnail": "https://api.martensen.dev/f/thumbnail/1testing/d9e3c4ca72bbd3ec819d656b4f60261e0ebed7e0db7870203ba1aee9d5823154.png" } }
POST: /f/delete, defaults={“path”: “”}
Deleter multiple files or folder
- headers:
- x-api-key (string)UUID (string)files (json)
JSON format:
{"files": [ {"path": "home/images", "encrypted": "6af137afb25bbe0c2a9f25f48f7722cac97c84aaac63de963af5b0d502fc97c5.jpg"}, ... ] }
Return Example:
{"codes": [200]}
GET: /corrupt
Get a corrupt and unopenable file
- headers:
- filename (string) - (Optional) - filenamesize (int) - (Optional) - Filesize in bytes
Return Example:
file