Following are the steps I followed to have further understanding
-
Know the architecture from this link. Whether the API totally encapsulates the CGI or there are some differences, that is not the topic of this guide, so it's better to be always aware of the Disk Station Architecture your script would support, so that when we have to read the sources we'll know which source to check
-
Try a working ansible role. That will give a pretty good overview of how the interaction is implemented.
-
Check the official docs for the
NOTE: these docs don't cover all the API, they're only a subset.
Here is a list of all the APIs I know of
- Covered APIs in docs
- Survellience Station: including
SYNO.SurveillanceStation.*
- File Station: including
SYNO.FileStation.*
- Auth: including
SYNO.API.Auth
- Synology Calendar: including
SYNO.Cal.*
[Not found in the following syno package] - Virtual Machine Manager: including
SYNO.Virtualization.API.*
[Not found in the following syno package]
- Survellience Station: including
- Uncovered APIs in docs
- Download Station: including
SYNO.DownloadStation.*
- Disk Station Manager: including
SYNO.Core.*
&SYNO.DSM.*
- Audio Station: including
SYNO.VideoStation.*
- Video Station: including
SYNO.VideoStation.*
- Video Station DTV: including
SYNO.DTV.*
The covered docs have a listing of the methods and their attributes available for each API. For the uncovered APIs we have no way to figure out the available methods unless ... we reach the source code ... but how can we find it, and are there any software that was able to extract such API, the answer is yes for methods but not directly for attributes :/
- Download Station: including
-
Try syno package locally; install the dependencies and add the config file as described in the README.md. Following this package we can finally reach the point where we can search for all the methods available for an API by checking the
scripts
directory in which the downloading and extraction of the methods occur. Notice that here one will need to know both the architecture and the desired packages. -
Check the sources found in the link captured from the
syno
package Try to download the spks of interest, and extracting them.
Then prettyprint the json found in thepackages/*.lib
files which will the methods.
As for the attributes, we have got one of 2 options (and half).
-
Check the source code, that should be the first resort upon figuring out that the documentation is totally messed up. However, due to the fact that Synology doesn't upload the many of sources too, this solution won't work :/
-
Reverse engineer the webapi by creating requests to the synology and checking the network, then capturing the sent params and trying to mimic it. The bad thing is that, if there are 2 consecutive requests, or some ciphered param, there's no way to tell what was missing or how to cipher a similar one :|
-
If one has time, he could reverse engineer the .so files to get the behavior, so that pseudo-source codes are available :/