You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you find yourself on this page,
most probably you are trying to develop something for your NAS,
this wrapper might come to your help to build your script.
I would like to specify that I do this for hobby as is my passion and in my little free time.
Said this, there is no warranties chained and this library is provided "As Is",
you will find many things can be simplified, and I slowly will but feel free to Contribute.
fromsynology_apiimportfilestation, downloadstation# Initiate the classes DownloadStation & FileStation with (ip_address, port, username, password)# it will log in automatically # NOTE: for Filestation and Downloadstation only has been added interactive_output=True,# It can be omitted and initiate the wrapper with the below ove codefl=filestation.FileStation('Synology Ip', 'Synology Port', 'Username', 'Password', secure=False, cert_verify=False, dsm_version=7, debug=True, otp_code=None)
fl.`get_info()`dwn=downloadstation.DownloadStation('Synology Ip', 'Synology Port', 'Username', 'Password', secure=False, cert_verify=False, dsm_version=7, debug=True, otp_code=None)
dwn.`get_info()`
the secure=True variable is needed to be set to true if https is required; default value is False
the cert_verify=True is optional, if you want to verify your certificate set it to True; default value is False
the dsm_version=7 is optional, make sure to set '7' if you use DSM version 7 or above, if left blank default value
will be for DSM 6 or below
the debug=True is optional, if set to False not all responses will return to console
If your login require otp_code you can set it changing the None value.
Available Functions
There are quite few available functions so... I will need to write a documentation as
I will slowly implement more functions, Synology APIs are plenty, too many for my little time.
To explain the use of some function I will divide all the functions in two sets
you can run the following set of functions at your will entering just the required data,
Function
Description
get_info()
Provide File Station information.
get_list_share()
List all shared folders.
get_file_list()
Enumerate files in a given folder.
get_file_info()
Get information of file(s).
get_mount_point_list()
List all mount point folders on one given type of virtual file system.
get_favorite_list()
List user’s favorites.
add_a_favorite()
Add a folder to user’s favorites.
delete_a_favorite()
Delete a favorite in user’s favorites.
clear_broken_favorite()
Delete all broken statuses of favorites.
edit_favorite_name()
Edit a favorite name.
replace_all_favorite()
Replace multiple favorites of folders to the existed user’s favorites.
check_permission()
Check if a logged-in user has write permission to create new files/folders in a given folder.
upload_file()
Upload a file to the station. (fix by @longyn)
get_shared_link_info()
Get information of a sharing link by the sharing link ID.
get_shared_link_list()
List user’s file sharing links.
create_sharing_link()
Generate one or more sharing link(s) by file/folder path(s).
delete_shared_link()
Delete one or more sharing links.
clear_invalid_shared_link()
Remove all expired and broken sharing links.
edit_shared_link()
Edit sharing link(s).
create_folder()
Create folders.
rename_folder()
Rename a file/folder.
delete_blocking_function()
Delete files/folders. This is a blocking method. The response is not returned until the deletion operation is completed.
get_file_list_of_archive()
List archived files contained in an archive.
get_list_of_all_background_task()
List all background tasks including copy, move, delete, compress and extract tasks.
To run the following functions you'll have to start the task with the start function
Function
Description
search_start()
Search files according to given criteria.
get_search_list()
List matched files in a search temporary database.
stop_search_task()
Stop the searching task.
stop_all_search_task()
Stop the all searching tasks.
start_dir_size_calc()
Start to calculate size for one or more file/folder paths.
get_dir_status()
Get the status of the size calculating task.
stop_dir_size_calc()
Stop to calculate size.
start_copy_move()
Start to copy/move files.
get_copy_move_status()
Get the copying/moving status.
stop_copy_move_task()
Stop a copy/move task.
start_delete_task()
Delete file(s)/folder(s).
get_delete_status()
Get the deleting status.
stop_delete_task()
Stop a delete task.
start_extract_task()
Start to extract an archive.
get_extract_status()
Get the extract task status.
stop_extract_task()
Stop the extract task.
start_file_compression()
Start to compress file(s)/folder(s).
get_compress_status()
Get the compress task status.
stop_compress_task()
Stop the compress task.
get_file()
Download or open file.
DownloadStations functions:
For some of DownloadStation API there is the possibility to set version 2, ex. SYNO.DownloadStation.BTSearch,
if you encounter problems you might set download_st_version = 2 during initialization.
Function
Description
get_info()
Download Station info.
get_config()
Download Station Settings info.
set_server_config()
Sets Download Station settings.
schedule_info()
Provides advanced schedule settings info.
schedule_set_config()
Sets advanced schedule settings.
tasks_list()
Provides task listing.
tasks_info()
Provides detailed task information.
tasks_source()
Provides the original torrent file.
create_task
Create a download task.
delete_task()
Delete a Task.
pause_task()
Pause a Task.
resume_task()
Resume a task.
edit_task()
Edit a Task.
Photo functions:
Function
get_userinfo()
get_folder()
list_folders()
list_teams_folders()
count_folders()
count_team_folders()
lookup_folder()
lookup_team_folder()
get_album()
list_albums()
suggest_condition()
create_album()
delete_album()
set_album_condition()
share_album()
share_team_folder()
list_shareable_users_and_groups()
list_item_in_folders()
list_search_filters()
get_guest_settings()
core_sys_info:
Although there is nothing you can set (yet), is possible to retrieve lots of
DS info with below functions:
Functions
fileserv_smb()
fileserv_afp()
fileserv_nfs()
fileserv_ftp()
fileserv_sftp()
network_backup_info()
bandwidth_control_protocol()
shared_folders_info()
services_status()
services_discovery()
file_transfer_status()
network_status()
web_status()
current_connection()
bandwidth_control_status()
sys_status()
latest_logs()
client_notify_settings_status()
get_security_scan_info()
get_security_scan_rules()
get_security_scan_status()
get_user_list()
quickconnect_info()
quickconnect_permissions()
network_topology()
network_wifi_client()
network_bond()
network_bridge()
network_ethernet()
network_local_bridge()
network_usb_modem()
network_pppoe()
network_ipv6tunnel()
network_vpn_pptp()
network_openvpn()
network_vpn_l2tp()
domain_schedule()
client_ldap()
client_sso()
sys_upgrade_check()
sys_upgrade_download()
sys_upgrade_setting()
notification_sms_conf()
notification_mail_conf()
notification_push_mail()
notification_push_conf()
hardware_beep_control()
hardware_fan_speed()
hardware_hibernation()
hardware_ups()
hardware_power_schedule()
terminal_info()
snmp_info()
process()
utilisation()
storage()
external_device_storage_usb()
external_device_storage_esata()
file_index_resource()
cms_info()
port_forwarding_rules()
port_forwarding_router_conf()
disk_list()
ddns_provider_info()
ddns_record_info()
ddns_external_ip()
ddns_synology()
iscsi_lun_info()
hddman()
ftp_security_info()
bandwidth_control_info()
directory_domain_info()
ws_transfer_info()
ref_link_copy_info()
bonjour_service_info()
users_info()
password_policy()
password_expiry()
password_confirm()
personal_photo_enable()
ftp_chroot_user()
server_pair()
groups_info()
ldap_info()
sso_iwa_info()
sso_info()
network_interface_info()
proxy_info()
gateway_list()
firewall_info()
auto_upgrade_status()
upgrade_server_check()
set_fan_speed()
enable_zram()
enable_power_recovery()
enable_beep_control()
set_led_control()
set_hibernation()
enable_external_ups()
get_system_info()
get_cpu_temp()
get_network_info()
get_volume_info()
get_all_system_utilization()
get_cpu_utilization()
get_disk_utilization()
get_memory_utilization()
dsm_info()
Virtualization
Functions
get_task_list()
clear_task()
get_taks_info()
get_network_group_list()
get_storage_operation()
get_host_operation()
get_vm_operation()
get_specific_vm_info()
set_vm_property()
delete_vm()
vm_power_on()
vm_force_power_off()
vm_shut_down()
get_images_list()
delete_image()
create_image()
core_backup Hyper Backup
Functions
Description
backup_repository_get()
Get repository information for given task.
backup_repository_list()
List of present repositories.
backup_task_list()
Get current restoring information and list of present tasks.
backup_task_status()
Get status and state of task.
backup_task_get()
Get task information.
backup_task_result()
Get last result summary information of a task.
backup_task_run()
Run task.
backup_task_cancel()
Cancel ongoing task.
backup_task_suspend()
Suspend ongoing task.
backup_task_discard()
Discard suspended task.
backup_task_resume()
Resume suspended task.
backup_task_remove()
Remove one or more tasks.
integrity_check_run()
Run integrity check for given task.
integrity_check_cancel()
Cancel ongoing integrity check.
hb_logs_get()
Get Hyper Backup UI logs.
core_backup Hyper Backup Vault
Functions
Description
vault_target_list()
List of all targets in Vault.
vault_concurrency_get()
Get number of concurrent tasks allowed to run in HB Vault.
vault_concurrency_set()
Set number of concurrent tasks allowed to run in HB Vault.
vault_target_settings_get()
Get settings of target.
vault_task_statistics_get()
Get statistics from task.
vault_target_logs_get()
Get logs of specific target.
core_active_backup Active Backup for Business
Functions
Description
list_vm_hypervisor()
List of all configured hypervisors.
list_device_transfer_size()
List of all devices and their respective transfer size.
list_storage()
List of all storages.
list_logs()
List of logs.
list_logs_details()
Detailed list of task logs.
backup_task_list()
List of all tasks.
backup_task_run()
Run given task(s).
backup_task_cancel()
Cancel given task(s).
backup_task_remove()
Remove given task(s).
backup_task_delete_versions()
Delete given version(s).
core_certificate tnx to @ajarzyn
Functions
Description
list_cert()
List certificates.
set_default_cert()
Set default certificate.
upload_cert()
Upload a certificate.
vpn
Functions
settings_list()
active_connections_list()
log_list()
network_interface_setting()
security_autoblock_setting()
permission_setting()
pptp_settings_info()
openvpn_settings_info()
l2tp_settings_info()
oauth
Functions
clients()
tokens()
logs()
security_advisor
Functions
general_info()
security_scan()
checklist()
login_activity()
advisor_config()
scan_config()
dhcp_server
Functions
general_info()
vendor()
pxe()
tftp()
network_bond()
network_ethernet()
dhcp_clientlist()
dhcp_reservations()
usb_copy
Functions
usb_copy_info()
toggle_usb_copy()
logs()
global_settings()
log_center
Functions
logcenter()
client_status_cnt()
client_status_eps()
remote_log_archives()
display_logs()
setting_storage_list()
registry_send_list()
history()
snapshot (Snapshot Replication)
Functions
list_snapshots()
create_snapshot()
delete_snapshots()
set_snapshot_attr()
cloud_sync (Cloud Sync)
Functions
Description
get_pkg_config()
Retrieve the package configuration.
get_connections()
Get connection details.
get_connection_settings()
Get settings for a specific connection.
get_connection_information()
Get cloud information for a specific connection.
get_connection_auth()
Retrieve authentication details for a connection.
get_connection_logs()
Retrieve logs for a specific connection.
get_tasks()
Get tasks associated with a specific connection.
get_task_filters()
Retrieve filters applied to tasks for a specific session.
get_task_cloud_folders()
Retrieve cloud folders associated with tasks.
get_recently_modified()
Retrieve recently modified resources.
set_pkg_config()
Set or update the package configuration.
set_relink_behavior()
Set behavior for relinking tasks.
set_connection_settings()
Set or update settings for a connection.
set_connection_schedule()
Define or update the schedule for a connection.
set_task_settings()
Update task settings.
set_task_filters()
Apply or modify filters to tasks.
connection_pause()
Pause a specific or all connections.
connection_resume()
Resume a paused or all connections.
connection_remove()
Remove a specific connection.
create_sync_task_s3()
Add new task to connection(Only S3 tested).
test_task_setting()
Test a task configuration before adding it.
task_remove()
Remove a specific task.
task_scheduler
Functions
Description
get_output_config()
Retrieve the task output configuration.
get_task_list()
Retrieve list of Scheduled and Event tasks.
get_task_config()
Get Scheduled task settings.
get_task_results()
Get results of a Scheduled task.
set_output_config()
Set the task output configuration.
task_set_enable()
Enable or disable a Scheduled task.
task_run()
Run a Scheduled task.
task_delete()
Delete a Scheduled task.
create_script_task()
Create a "User defined script scheduled task".
modify_script_task()
Modify a "User defined script scheduled task".
create_beep_control_task()
Create a "Beep control scheduled task".
modify_beep_control_task()
Modify a "Beep control scheduled task".
create_service_control_task()
Create a "Service scheduled task".
modify_service_control_task()
Modify a "Service scheduled task".
create_recycle_bin_task()
Create a "Recycle Bin scheduled task".
modify_recycle_bin_task()
Modify a "Recycle Bin scheduled task".
event_scheduler
Functions
Description
get_task_results()
Get results of a Event Triggered task.
get_result_output()
Get the output for a given result.
task_set_enable()
Enable or disable a Event Triggered task.
task_run()
Run a Event Triggered task.
task_delete()
Delete a Event Triggered task.
task_create_or_set()
Create or modify a Event Triggered task.
What's still missing
There is still few missing function for the api supplied from Synology which is a work in progress:
Missing in FileStation
SYNO.FileStation.Thumb
Missing in Virtualization
SYNO.Virtualization.API.Guest create
Bugs
Maybe?
I hate bugs..
well report them please (if you'll ever use this code)
Conclusions
There is still a lot to implement.
The code is probably in some parts twisted, I will try to optimize it at best