FileStation
This API is not documented yet.
Overview​
FileStation API implementation.
Provides methods to interact with Synology NAS FileStation API for file and folder operations, search, upload, download, and background task management.
Parameters​
ip_address : str IP address of the Synology NAS. port : str Port number for the connection. username : str Username for authentication. password : str Password for authentication. secure : bool, optional Use HTTPS if True, HTTP otherwise. Default is False. cert_verify : bool, optional Verify SSL certificates if True. Default is False. dsm_version : int, optional DSM version of the Synology NAS. Default is 7. debug : bool, optional Enable debug output if True. Default is True. otp_code : str, optional One-time password for 2-step verification. Default is None. device_id : str, optional Device ID for authentication. Default is None. device_name : str, optional Name of the device. Default is None. interactive_output : bool, optional If True, enables interactive output. Default is False.
Methods​
get_info
​
Get FileStation information.
Internal API​
SYNO.FileStation.Info
Returns​
dict[str, object] or str
FileStation information or error message.
get_list_share
​
List shared folders.
Internal API​
SYNO.FileStation.List
Parameters​
additional str or list of str
Additional attributes to include.
offset int
Offset for pagination.
limit int
Limit for pagination.
sort_by str
Field to sort by.
sort_direction str
Sort direction ('asc' or 'desc').
onlywritable bool
If True, only writable shares are listed.
Returns​
dict[str, object] or str
List of shared folders or error message.
get_file_list
​
List files in a folder.
Internal API​
SYNO.FileStation.List
Parameters​
folder_path str
Path to the folder.
offset int
Offset for pagination.
limit int
Limit for pagination.
sort_by str
Field to sort by.
sort_direction str
Sort direction ('asc' or 'desc').
pattern str
Pattern to filter files.
filetype str
File type filter.
goto_path str
Path to go to.
additional str or list of str
Additional attributes to include.
Returns​
dict[str, object]
List of files or error message.
get_file_info
​
Get information about a file or files.
Internal API​
SYNO.FileStation.List
Parameters​
path str or list of str
Path(s) to the file(s).
additional str or list of str
Additional attributes to include.
Returns​
dict[str, object] or str
File information or error message.
search_start
​
Start a search task.
Internal API​
SYNO.FileStation.Search
Parameters​
folder_path str
Path to the folder where the search will start.
recursive bool
If True, the search will be recursive.
pattern str
Pattern to search for.
extension str
File extension to filter by.
filetype str
File type filter.
size_from int
Minimum file size.
size_to int
Maximum file size.
mtime_from str or int
Minimum modification time (Unix timestamp or formatted string).
mtime_to str or int
Maximum modification time (Unix timestamp or formatted string).
crtime_from str or int
Minimum creation time (Unix timestamp or formatted string).
crtime_to str or int
Maximum creation time (Unix timestamp or formatted string).
atime_from str or int
Minimum access time (Unix timestamp or formatted string).
atime_to str or int
Maximum access time (Unix timestamp or formatted string).
owner str
Owner filter.
group str
Group filter.
Returns​
dict[str, object] or str
Search task ID or error message.
get_search_list
​
Get the results of a search task.
Internal API​
SYNO.FileStation.Search
Parameters​
task_id str
Task ID of the search task.
filetype str
File type filter.
limit int
Limit for pagination.
sort_by str
Field to sort by.
sort_direction str
Sort direction ('asc' or 'desc').
offset int
Offset for pagination.
additional str or list of str
Additional attributes to include.
Returns​
dict[str, object] or str
Search results or error message.
stop_search_task
​
Stop a search task.
Internal API​
SYNO.FileStation.Search
Parameters​
taskid str
Task ID of the search task to stop.
Returns​
dict[str, object] or str
Response from the API or error message.
stop_all_search_task
​
Stop all running search tasks.
Internal API​
SYNO.FileStation.Search
Returns​
str
Confirmation message.
get_mount_point_list
​
List mount points.
Internal API​
SYNO.FileStation.VirtualFolder
Parameters​
mount_type str
Type of mount point to filter by.
offset int
Offset for pagination.
limit int
Limit for pagination.
sort_by str
Field to sort by.
sort_direction str
Sort direction ('asc' or 'desc').
additional str or list of str
Additional attributes to include.
Returns​
dict[str, object] or str
List of mount points or error message.
get_favorite_list
​
List favorite files and folders.
Internal API​
SYNO.FileStation.Favorite
Parameters​
offset int
Offset for pagination.
limit int
Limit for pagination.
sort_by str
Field to sort by.
status_filter str
Status filter.
additional str or list of str
Additional attributes to include.
Returns​
dict[str, object] or str
List of favorites or error message.
add_a_favorite
​
Add a file or folder to favorites.
Internal API​
SYNO.FileStation.Favorite
Parameters​
path str
Path to the file or folder.
name str
Name for the favorite.
index int
Index for the favorite.
Returns​
dict[str, object] or str
Response from the API or error message.
delete_a_favorite
​
Delete a favorite.
Internal API​
SYNO.FileStation.Favorite
Parameters​
path str
Path to the favorite to delete.
Returns​
dict[str, object] or str
Response from the API or error message.
clear_broken_favorite
​
Clear broken favorites.
Internal API​
SYNO.FileStation.Favorite
Returns​
dict[str, object] or str
Response from the API or error message.
edit_favorite_name
​
Edit the name of a favorite.
Internal API​
SYNO.FileStation.Favorite
Parameters​
path str
Path to the favorite.
new_name str
New name for the favorite.
Returns​
dict[str, object] or str
Response from the API or error message.
replace_all_favorite
​
Replace all favorites with new paths and names.
Internal API​
SYNO.FileStation.Favorite
Parameters​
path str or list of str
New path or list of new paths for the favorites.
name str or list of str
New name or list of new names for the favorites.
Returns​
dict[str, object] or str
Response from the API or error message.
start_dir_size_calc
​
Start a directory size calculation task.
Internal API​
SYNO.FileStation.DirSize
Parameters​
path str
Path to the directory.
Returns​
dict[str, object] or str
Task ID or error message.
stop_dir_size_calc
​
Stop a directory size calculation task.
Internal API​
SYNO.FileStation.DirSize
Parameters​
taskid str
Task ID of the size calculation task to stop.
Returns​
str
Confirmation message.
get_dir_status
​
Get the status of a directory size calculation task.
Internal API​
SYNO.FileStation.DirSize
Parameters​
taskid str
Task ID of the size calculation task.
Returns​
dict[str, object] or str
Task status or error message.
start_md5_calc
​
Start an MD5 calculation task.
Internal API​
SYNO.FileStation.MD5
Parameters​
file_path str
Path to the file.
Returns​
str or dict[str, object]
Task ID or error message.
get_md5_status
​
Get the status of an MD5 calculation task.
Internal API​
SYNO.FileStation.MD5
Parameters​
taskid str
Task ID of the MD5 calculation task.
Returns​
str or dict[str, object]
Task status or error message.
stop_md5_calc
​
Stop an MD5 calculation task.
Internal API​
SYNO.FileStation.DirSize
Parameters​
taskid str
Task ID of the MD5 calculation task to stop.
Returns​
str
Confirmation message.
check_permissions
​
Check permissions for a file or folder.
Internal API​
SYNO.FileStation.CheckPermission
Parameters​
path str
Path to the file or folder.
filename str
Name of the file.
overwrite bool
If True, overwriting is allowed.
create_only bool
If True, only creation is allowed.
Returns​
dict[str, object] or str
Permission check result or error message.
upload_file
​
Upload a file to the server.
Internal API​
SYNO.FileStation.Upload
Parameters​
dest_path str
Destination path on the server.
file_path str
Path to the file to upload.
create_parents bool
If True, parent folders will be created.
overwrite bool
If True, existing files will be overwritten.
verify bool
If True, SSL certificates will be verified.
progress_bar bool
If True, shows a progress bar during upload.
Returns​
str or tuple[int, dict[str, object]]
Upload result or error message.
get_shared_link_info
​
Get information about a shared link.
Internal API​
SYNO.FileStation.Sharing
Parameters​
link_id str
ID of the shared link.
Returns​
dict[str, object] or str
Shared link information or error message.
get_shared_link_list
​
List shared links.
Internal API​
SYNO.FileStation.Sharing
Parameters​
offset int
Offset for pagination.
limit int
Limit for pagination.
sort_by str
Field to sort by.
sort_direction str
Sort direction ('asc' or 'desc').
force_clean bool
If True, forces a clean of the shared link list.
Returns​
dict[str, object] or str
List of shared links or error message.
create_sharing_link
​
Create a shared link.
Internal API​
SYNO.FileStation.Sharing
Parameters​
path str
Path to the file or folder to share.
password str
Password for the shared link.
date_expired str or int
Expiration date for the shared link (Unix timestamp or formatted string).
date_available str or int
Availability date for the shared link (Unix timestamp or formatted string).
expire_times int
Number of times the link can be accessed before expiring.
Returns​
dict[str, object] or str
Shared link details or error message.
delete_shared_link
​
Delete a shared link.
Internal API​
SYNO.FileStation.Sharing
Parameters​
link_id str
ID of the shared link to delete.
Returns​
dict[str, object] or str
Response from the API or error message.
clear_invalid_shared_link
​
Clear invalid shared links.
Internal API​
SYNO.FileStation.Sharing
Returns​
dict[str, object] or str
Response from the API or error message.
edit_shared_link
​
Edit a shared link.
Internal API​
SYNO.FileStation.Sharing
Parameters​
link_id str
ID of the shared link to edit.
password str
New password for the shared link.
date_expired str or int
New expiration date for the shared link (Unix timestamp or formatted string).
date_available str or int
New availability date for the shared link (Unix timestamp or formatted string).
expire_times int
New number of times the link can be accessed before expiring.
Returns​
dict[str, object] or str
Response from the API or error message.
create_folder
​
Create a new folder.
Internal API​
SYNO.FileStation.CreateFolder
Parameters​
folder_path str or list of str
Path or list of paths where the folder should be created.
name str or list of str
Name or list of names for the new folder.
force_parent bool
If True, parent folders will be created if they don't exist.
additional str or list of str
Additional attributes to include.
Returns​
str or dict[str, object]
Creation result or error message.
rename_folder
​
Rename a folder.
Internal API​
SYNO.FileStation.Rename
Parameters​
path str or list of str
Current path or list of paths of the folder(s) to rename.
name str or list of str
New name or list of new names for the folder(s).
additional str or list of str
Additional attributes to include.
search_taskid str
Task ID of a search task.
Returns​
dict[str, object] or str
Response from the API or error message.
start_copy_move
​
Start a copy or move task.
Internal API​
SYNO.FileStation.CopyMove
Parameters​
path str or list of str
Source path or list of source paths to copy or move.
dest_folder_path str or list of str
Destination folder path or list of destination folder paths.
overwrite bool
If True, existing files will be overwritten.
remove_src bool
If True, source files will be removed after copying.
accurate_progress bool
If True, shows accurate progress.
search_taskid str
Task ID of a search task.
Returns​
str or dict[str, object]
Task ID or error message.
get_copy_move_status
​
Get the status of a copy or move task.
Internal API​
SYNO.FileStation.CopyMove
Parameters​
taskid str
Task ID of the copy or move task.
Returns​
dict[str, object] or str
Task status or error message.
stop_copy_move_task
​
Stop a copy or move task.
Internal API​
SYNO.FileStation.CopyMove
Parameters​
taskid str
Task ID of the copy or move task to stop.
Returns​
dict[str, object] or str
Response from the API or error message.
start_delete_task
​
Start a delete task.
Internal API​
SYNO.FileStation.Delete
Parameters​
path str or list of str
Path or list of paths to the file or folder to delete.
accurate_progress bool
If True, shows accurate progress.
recursive bool
If True, deletes folders recursively.
search_taskid str
Task ID of a search task.
Returns​
dict[str, object] or str
Task ID or error message.
get_delete_status
​
Get the status of a delete task.
Internal API​
SYNO.FileStation.Delete
Parameters​
taskid str
Task ID of the delete task.
Returns​
dict[str, object] or str
Task status or error message.
stop_delete_task
​
Stop a delete task.
Internal API​
SYNO.FileStation.Delete
Parameters​
taskid str
Task ID of the delete task to stop.
Returns​
dict[str, object] or str
Response from the API or error message.
delete_blocking_function
​
Delete a file or folder (blocking function).
This function will stop your script until done! Do not interrupt.
Internal API​
SYNO.FileStation.Delete
Parameters​
path str or list of str
Path or list of paths to the file or folder to delete.
recursive bool
If True, deletes folders recursively.
search_taskid str
Task ID of a search task.
Returns​
dict[str, object] or str
Response from the API or error message.
start_extract_task
​
Start an extract task.
Internal API​
SYNO.FileStation.Extract
Parameters​
file_path str
Path to the archive file.
dest_folder_path str
Destination folder path where the files will be extracted.
overwrite bool
If True, existing files will be overwritten.
keep_dir bool
If True, the original directory structure will be kept.
create_subfolder bool
If True, a subfolder will be created for the extracted files.
codepage str
Codepage for the extraction.
password str
Password for the archive, if required.
item_id str
Item ID for the extraction task.
Returns​
dict[str, object] or str
Task ID or error message.
get_extract_status
​
Get the status of an extract task.
Internal API​
SYNO.FileStation.Extract
Parameters​
taskid str
Task ID of the extract task.
Returns​
dict[str, object] or str
Task status or error message.
stop_extract_task
​
Stop an extract task.
Internal API​
SYNO.FileStation.Extract
Parameters​
taskid str
Task ID of the extract task to stop.
Returns​
dict[str, object] or str
Response from the API or error message.
get_file_list_of_archive
​
Get the list of files in an archive.
Internal API​
SYNO.FileStation.Extract
Parameters​
file_path str
Path to the archive file.
offset int
Offset for pagination.
limit int
Limit for pagination.
sort_by str
Field to sort by.
sort_direction str
Sort direction ('asc' or 'desc').
codepage str
Codepage for the file list.
password str
Password for the archive, if required.
item_id str
Item ID for the archive.
Returns​
dict[str, object] or str
List of files in the archive or error message.
start_file_compression
​
Start a file compression task.
Internal API​
SYNO.FileStation.Compress
Parameters​
path str or list of str
Path or list of paths to the file or folder to compress.
dest_file_path str
Destination file path for the compressed file.
level int
Compression level.
mode str
Compression mode.
compress_format str
Compression format.
password str
Password for the compressed file, if required.
Returns​
dict[str, object] or str
Task ID or error message.
get_compress_status
​
Get the status of a file compression task.
Internal API​
SYNO.FileStation.Compress
Parameters​
taskid str
Task ID of the compression task.
Returns​
dict[str, object] or str
Task status or error message.
stop_compress_task
​
Stop a file compression task.
Internal API​
SYNO.FileStation.Compress
Parameters​
taskid str
Task ID of the compression task to stop.
Returns​
dict[str, object] or str
Response from the API or error message.
get_list_of_all_background_task
​
Get a list of all background tasks.
Internal API​
SYNO.FileStation.BackgroundTask
Parameters​
offset int
Offset for pagination.
limit int
Limit for pagination.
sort_by str
Field to sort by.
sort_direction str
Sort direction ('asc' or 'desc').
api_filter str
API filter.
Returns​
dict[str, object] or str
List of background tasks or error message.
get_file
​
Download a file from the server.
Internal API​
SYNO.FileStation.Download
Parameters​
path str
Path to the file on the server.
mode str
Mode for downloading the file ('open' to open in browser, 'download' to download to disk).
dest_path str
Destination path on the local machine (for 'download' mode).
chunk_size int
Chunk size for downloading.
verify bool
If True, SSL certificates will be verified.
Returns​
Optional[str]
None if successful, error message otherwise.
generate_file_tree
​
Recursively generate the file tree based on the folder path you give constrained with.
You need to create the root node before calling this function.
Internal API​
hotfix
Parameters​
folder_path str
Folder path to generate file tree.
tree Tree
Instance of the Tree from the treelib
library.
max_depth int
Non-negative number of maximum depth of tree generation if node tree is directory, default to '1' to generate full tree. If 'max_depth=0' it will be equivalent to no recursion.
start_depth int
Non negative number to start to control tree generation default to '0'.