Synology NAS Python API
Synology Python API
This article goes a little off topic as it deals with a module written by me in Python 3 for, who knows it, our beloved Synology NAS.
The NAS in the image is only an example as the module will work with all DS series models.
Synology is an easy-to-use home and office NAS, accessible wherever you are thanks to its easy to understand and set up interface.
If you use a lot of python, to be precise python 3, and you like to create scripts or applications with this programming language, more over if you have a NAS of this kind, this wrapper could be for you.
link to the wrapper:
All instructions are included on the Github page, I will explain the installation and functions available in this wrapper.
To begin:
If you are on this page I assume that you are already familiar with python.
There are two methods to install this module, the easiest one is via pip install, in case you have no idea what it is first read this post.
from the terminal:
pip3 install git + https: //github.com/N4S4/synology-api
if you are on windows:
py -3 -m pip install git + https: //github.com/N4S4/synology-api
or you can manually download the package and extract it in the folder of your choice,
from terminal move to the wrapper folder:
cd path/of/wrapper
once in the folder run the command:
python3.x setup.py install
On windows:
py -3 setup.py install
Once this is done we are ready to use the wrapper for the most varied purposes (within the limit of the functions),
there are many functions available in this wrapper and I will continue to update and upgrade them.
the apps you can interact with (for now) are:
- SysInfo
- FileStation
- DownloadStation
- AudioStation
- Backup
- Virtualization
to use the module just import:
import synology_api
once imported you will need to initialize the class:
fl = filestation.FileStation ('Synology Ip', 'Synology Port', 'Username', 'Password')
now you can use all the functions related to the FileStation class for example:
fl.get_info ()
I will not list all the functions here as I think it is already exhaustive to read the description of the module on Github.
Obviously for any information, doubt or problem you can leave a comment.
In case you are familiar with the Github platform and want to contribute or report errors, do not hesitate to do it through the same.
I hope you will enjoy it.
And don't forget to sign up! 😇
I've been trying to test the Synology API with Postman. However I am unable to get it to work. I can authenticate successfully, but all subsequent requests that required 'sid' always return 403.
ReplyDeleteFor example this will return a 403. Even though I have copied the correct 'sid' value from the authentication request response.
/webapi/FileStation/entry.cgi?api=SYNO.FileStation.Info&version=1&_sid={sid}
Would you happen to know something that would help me?
You can use the github issue or telegram channel to ask for help, i am sure the your issue will be resolved overthere!
Delete