Add task to download station via API

login and session ID

login to DSM using the API method login in order to get the SID (session ID). In the example, the synology is hosted on 192.168.1.2 accessed via the port 5001 over https the login is myaccount and the password is pass123

https://192.168.1.2:5001/webapi/auth.cgi?api=SYNO.API.Auth&version=2&method=login&account=myaccount&passwd=pass123&session=DownloadStation&format=cookie

the return value should look like this

{"data":{"sid":"7JALx67b6pHpM1920PDN547503"},"success":true}

make sure to note that sid value for later.

Using Download Station through the API

Now that we are logged in and have the SID, we can add a download task by using the API method create to download the file https://file-examples.com/wp-content/uploads/2017/02/file-sample_100kB.doc to the share folder home. Don't forget to use the sid previouly copied.

https://192.168.1.2:5001/webapi/DownloadStation/task.cgi?api=SYNO.DownloadStation.Task&version=1&method=create&uri=https://file-examples.com/wp-content/uploads/2017/02/file-sample_100kB.doc&destination=home&_sid=7JALx67b6pHpM1920PDN547503

You can use curl -k in order to call this request form the command line.

You can find more information in the official API reference