Purpose
JimRobs developped a cool Node.js wrapper for the Synology DSM REST API but no Command Line Tool was available.
So i decided to develop my first Node.js CLI on top of this wrapper.
It’s now available with 1.0.2 version and below some examples how to use it.
CLI
Installation
BASH
$ npm install -g synoUsage
PLAINTEXT
$ syno --help
Usage: syno [options]
Synology Rest API Command Line
Options:
-h, --help output usage information
-V, --version output the version number
Commands:
filestation|fs [options] <method> DSM File Station API
downloadstation|dl [options] <method> DSM Download Station API
Examples:
$ syno filestation|fs getFileStationInfo
$ syno downloadstation|dl getDownloadStationInfoPLAINTEXT
$ syno fs --help
Usage: filestation|fs [options] <method>
DSM File Station API
Options:
-h, --help output usage information
-c, --config <path> DSM configuration file. Default to ~/.syno/auth.yaml
-u, --url <url> DSM URL. Default to https://admin:password@localhost:5001
-p, --payload <payload> JSON Payload
-P, --pretty Prettyprint JSON Output
-d, --debug Enabling Debugging Output
Examples:
$ syno filestation|fs listSharedFolders
$ syno filestation|fs listFiles --pretty --payload '{"folder_path":"/path/to/folder"}'PLAINTEXT
$ syno dl --help
Usage: downloadstation|dl [options] <method>
DSM Download Station API
Options:
-h, --help output usage information
-c, --config <path> DSM configuration file. Default to ~/.syno/auth.yaml
-u, --url <url> DSM URL. Default to https://admin:password@localhost:5001
-p, --payload <payload> JSON Payload
-P, --pretty Prettyprint JSON Output
-d, --debug Enabling Debugging Output
Examples:
$ syno downloadstation|dl createTask --payload '{"uri":"magnet|ed2k|ftp(s)|http(s)://link"}'
$ syno downloadstation|dl listTasks
$ syno downloadstation|dl listTasks --payload '{"limit":10}'
$ syno downloadstation|dl getTasksInfo --pretty --payload '{"id":"task_id"}'Examples
Without a configuration file
BASH
$ syno fs getFileStationInfo --url https://admin:[email protected]:5001 --prettyWith a configuration file
YAML
# Example config file, by default it should be located at:
# ~/.syno/config.conf
url:
protocol: https
host: localhost
port: 5001
account: admin
passwd: passwordBASH
$ syno fs getFileStationInfo --prettyIn real life ?
List Files via File Station
BASH
$ syno fs listFiles --payload '{"folder_path":"/photo"}' --prettyList Tasks via Download Station
BASH
$ syno dl listTasks --payload '{"limit":1}' --prettyAdd Task HTTP file via Download Station
BASH
$ syno dl createTask --payload '{"uri":"https://download.thinkbroadband.com/5MB.zip"}'Add Task Torrent magnet link via Download Station
BASH
$ syno dl createTask --payload '{"uri":"magnet:?xt=urn:ed2k:31D6CFE0D16AE931B73C59D7E0C089C0&xl=0&dn=zero_len.fil&xt=urn:bitprint:3I42H3S6NNFQ2MSVX7XZKYAYSCX5QBYJ.LWPNACQDBZRYXW3VHJVCJ64QBZNGHOHHHZWCLNQ&xt=urn:md5:D41D8CD98F00B204E9800998ECF8427E"}'