kwent / syno Goto Github PK
View Code? Open in Web Editor NEWSimple Node.js wrapper and CLI for Synology DSM REST API 5.x and 6.x.
Home Page: http://kwent.github.io/syno
License: MIT License
Simple Node.js wrapper and CLI for Synology DSM REST API 5.x and 6.x.
Home Page: http://kwent.github.io/syno
License: MIT License
Hi,
First of all, thank you for you work !
But i have a question, on your readme you have write a method to get file :
but on this page : https://github.com/kwent/syno/wiki/Download-Station-API
The method is not set ! it is not clear and i don't understand your documentation, so if you have some explanations for me :) !
Thanks you
I'm using the latest video station version.
listMovies
, library_id
is now a required parameter.getMovieInfo
does not exist anymore, it should be getInfoMovie
, which I can't get to work (can't figure out which parameters are needed besides id
because it simply returns null
).callback
function seems to need 2 parameters, only the second is filled with data, the first is unclear what it is for?Hello,
I follow the synology documentation to call additional like that:
syno.fs.list({
folder_path: path,
additional: "real_path,owner,time"
}, (error, architecture) => {
if (error) {
res.status(400);
return res.send(error);
}
return res.json(architecture);
});
That not working ..
But only one aditionnal working.. like that
syno.fs.list({
folder_path: path,
additional: "real_path"
}, (error, architecture) => {
if (error) {
res.status(400);
return res.send(error);
}
return res.json(architecture);
});
Thanks for help
How can I enter the code for 2-step authentication?
Hi,
how to run this API Call:
GET /webapi/entry.cgi?
api="SYNO.SurveillanceStation.Face.Result"&version="1"&method="List"&blIncludeSnapshot=false&blInclu
deRegisteredFace=false&filter={"start_date_ts":1593446400000,
"end_date_ts":1594051200000,"ignore_bad_quality":true}&limit=1&&slaveDsParam={"0":
{"max_id":88731, "start":0}}
described here on Page 540 https://global.download.synology.com/download/Document/Software/DeveloperGuide/Package/SurveillanceStation/All/enu/Surveillance_Station_Web_API.pdf
thried this:
syno.ss.Face.Result({'method':'List','blIncludeSnapshot': true, 'blIncludeRegisteredFace': true}, function(err,res){
console.log(res)
});
with this result:
/node/faces.js:22
syno.ss.Face.Result({'method':'List','blIncludeSnapshot': true, 'blIncludeRegisteredFace': true}, function(err,res){
^
TypeError: Cannot read property 'Result' of undefined
at Object.<anonymous> (/node/faces.js:22:14)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
Hello,
I've make a quick try of the library but get a 402 error:
var Syno = require('./dist/syno');
var syno = new Syno({
// Requests protocol : 'http' or 'https' (default: http)
protocol: 'http',
// DSM host : ip, domain name (default: localhost)
host: 'my_synology',
// DSM port : port number (default: 5000)
port: '5000',
// DSM User account (required)
account: 'yyy',
// DSM User password (required)
passwd: 'xxx'
});
syno.as.listAlbums(function(data){
console.log(data);
});
The result is:
/usr/local/Cellar/node/0.10.22/bin/node test_syno.js
{ [Error: Permission denied] code: 402 }
Is there a way to use OAuth as login method to persist and reuse that "permission"?
I was wondering whether there are any Typescript typings for syno.
Hi there,
Thanks for providing this package, it's really handy and will save me quite a lot of time... if I can get it to work :)
I'm trying to use the package in a React app. I've installed it using npm, no problem.
I loaded it import Syno from 'syno';
, just like I do for every other package.
But when I build the Syno object const syno = new Syno({...})
, it's throwing a TypeError: fs.readFileSync is not a function
. I believe that's because the package doesn't know it's currently loaded in a browser and so doesn't have access to the file system, correct ?
I also tried const syno = new Syno.Syno({...})
but I get a TypeError: _syno2.default.Syno is not a constructor
When I use var Syno = require('syno.Syno');
, I get a compilation fail Module not found: 'syno.Syno'
.
I'm a bit stumped right now. Am I just missing something simple ?
When i run:
syno dsm --ignore-certificate-errors --pretty getUser
From where i know what payload i must add?
Please let us know if this repository is still maintained and fixes / adaptions (i.e. DSM7) are to be expected within a reasonable time frame.
First of all - thanks for implementing - that saved me a lot of work and its usage is really straight forward.
But I do have a question about the control of the request version (not that of the API). I am trying to enable/disable a camera based on an event. I know that the surveillance api has the possibility to since v3 (based on your _full.json)
By default it looks to me that it is always using v1 - because of this:
version = 'minVersion' in definitions[api] ? definitions[api].minVersion : 1;
So I changed the min version to 8, which actually helps me with this problem but opens up another one :) getInfoCamera changed its response data between those versions 1 and 8.
So what I am trying is to control the version on each request. So that I can go with v1 on getInfoCamera and with v8 on enableCamera/disableCamera.
Is that possible?
And what is the recommended way to enable a specific version - I don't think changing the minor version in the _full.json is the recommended one ;-)
Thanks and have a happy new year!
m.
Hi,
Are there any plans to officially support DMS 7.x.x?
And if yes, is there a timeframe?
Thanks for any feedback.
P.S: I do do not yet have a concrete issue, but befor I start really using syno.js I would like to know whther it is still maintained (last dpendecy commit 1 year ago, last bugfix / feature commit seems o be much longer ago)
Are you planing on upgrading the package to fix the api-changes that where made with dsm 6 release?
I tried to retrive volume status using this command, but I got empty output:
syno.dsm.listShares({
additional : "volume_status"
}, function(error, data) {
console.log(data) ;
});
{ shares: [], total: 0 }
Using the listShares without parameter I got this output:
{ shares: [ { desc: '', is_usb_share: false, name: 'Backup', uuid: 'bd2be816-11f7-4c70-a78f-239bd8971239', vol_path: '/volume1' }, { desc: 'user home', is_usb_share: false, name: 'homes', uuid: '62e4370c-cf28-4320-8076-1430a8d5d97e', vol_path: '/volume1' }, { desc: '', is_usb_share: false, name: 'Moreno', uuid: '7b10e336-1f52-4256-bc6b-2f54650da33f', vol_path: '/volume1' }, { desc: 'NAKIVO Repository', is_usb_share: false, name: 'NAKIVO_Repository', uuid: 'a4f76933-0aec-4221-82c1-78cf0f609af5', vol_path: '/volume1' }, { desc: 'System default shared folder', is_usb_share: false, name: 'web', uuid: '16fe6bd7-1610-477b-b4de-8bbf607228d8', vol_path: '/volume1' } ], total: 5 }
From the API documentation:
additional parameter is optional and when additional option is requested, responded objects will be provided in the specified addiontal option.
So what is the problem?
Hi,
I'm looking for a way to shutdown the disk station as found here: https://github.com/kwent/syno/blob/master/definitions/DSM/6.0/7321/SYNO.Core.System.lib#L1
How can I invoke this method? syno.dsm.shutdown()
does not work and the cli doesn't recognize syno dsm shutdown
either:
node_modules/syno/bin/syno.js:55
return syno[api][cmd](payload, function(err, data) {
^TypeError: syno[api][cmd] is not a function
at execute (node_modules/syno/bin/syno.js:55:24)
at Command. (node_modules/syno/bin/syno.js:256:10)
at Command.listener (node_modules/syno/node_modules/commander/index.js:301:8)
at emitTwo (events.js:106:13)
at Command.emit (events.js:191:7)
at Command.parseArgs (node_modules/syno/node_modules/commander/index.js:615:12)
at Command.parse (node_modules/syno/node_modules/commander/index.js:458:21)
at Object. (node_modules/syno/bin/syno.js:347:9)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
Any help is greatly appreciated.
https://github.com/yannickcr/node-synology/blob/master/lib/dsm.js
Can you add DSM info?
module.exports = function(syno) {
return {
info : info.bind(syno),
application : application.bind(syno),
autoBlock : autoBlock.bind(syno),
connection : connection.bind(syno),
encryptShare : encryptShare.bind(syno),
findMe : findMe.bind(syno),
group : group.bind(syno),
logViewer : logViewer.bind(syno),
network : network.bind(syno),
package : pkg.bind(syno),
pushNotification: pushNotification.bind(syno),
service : service.bind(syno),
share : share.bind(syno),
system : system.bind(syno),
systemLoading : systemLoading.bind(syno),
user : user.bind(syno),
volume : volume.bind(syno),
iSCSI : iSCSI.bind(syno)
};
};
Hi,
Is it possible to use api through quickconnect?
Regards,
Vit3k
Hello,
getting 500, don't know why :
GET /nas/fs/getMethods 500 6.580 ms - 4591
[watch:server] TypeError: done is not a function
[watch:server] at FileStation.getMethods (/Users/alexyfondeville/Desktop/Afondevi-All-Project/nasaf-webresources-api/node_modules/syno/dist/syno.js:489:26)
...
running that :
static getMethodsFs(req, res){
syno.fs.getMethods((error, methods) => {
if (error) {
return res.json(error);
}
return res.json(methods);
});
}
Hello!
I was wondering if it's possible to prevent users to type their usernames and passwords each time.
Is it possible, for example, to use the session cookies or sessionId set by the DSM to automatically sign in the last user?
Thank you!
This causes a TypeError: syno.vs.listTVShows is not a function. What am I doing wrong? The documentation is not clear.
var Syno = require('syno');
var syno = new Syno({
protocol: 'https',
host: 'server',
port: '5001',
account: 'Me',
passwd: 'Password',
apiVersion: '6.0.2'
});
syno.vs.listTVShows({}, function(data){
console.log(data);
return res.json({
message: "Running Fine!"
});
});
Does this package support the photo-station package and API?
Thanks.
I get this error:
syno fs getFileStationInfo --pretty
/usr/lib/node_modules/syno/dist/syno.js:78
code = body.error ? body.error.code : body.data[0].error;
^
TypeError: Cannot read property '0' of undefined
at Request._callback (/usr/lib/node_modules/syno/dist/syno.js:78:72)
at Request.self.callback (/usr/lib/node_modules/syno/node_modules/request/request.js:199:22)
at emitTwo (events.js:87:13)
at Request.emit (events.js:172:7)
at Request.<anonymous> (/usr/lib/node_modules/syno/node_modules/request/request.js:1036:10)
at emitOne (events.js:82:20)
at Request.emit (events.js:169:7)
at IncomingMessage.<anonymous> (/usr/lib/node_modules/syno/node_modules/request/request.js:963:12)
at emitNone (events.js:72:20)
at IncomingMessage.emit (events.js:166:7)
The password is correct with above message. I tested by trying with a wrong password and got:
syno fs getFileStationInfo --pretty [ERROR] : Error: Permission denied
I am running DSM 6.0-7307 / this is the current release candidate of DSM 6.0.
I'm on dsm 5.2 and this is what I got after installing this module and trying a sample command:
DiskStation> syno -d fs getInfo --pretty
[DEBUG] : DSM Connection URL configured : http://USERNAME:PASSWORD@localhost:5000
[DEBUG] : Account: USERNAME
[DEBUG] : Password: PASSWORD
[DEBUG] : Host: localhost
[DEBUG] : Port: 5000
[DEBUG] : API: 6.0
[DEBUG] : Ignore certificate errors: false
[DEBUG] : DSM File Station API command selected
[DEBUG] : Method name configured : getInfo
[DEBUG] : Prettify output detected
REQUEST { rejectUnauthorized: true,
jar: true,
json: true,
url: 'http://localhost:5000/webapi/auth.cgi',
qs:
{ api: 'SYNO.API.Auth',
version: 3,
method: 'login',
account: 'USERNAME',
passwd: 'PASSWORD',
session: 'SYNO_SESSION_1471955298784' },
callback: [Function] }
REQUEST make request http://localhost:5000/webapi/auth.cgi?a ... 1955298784
REQUEST onRequestResponse http://localhost:5000/webapi/auth.cgi?a ... 1955298784 200 { date: 'Tue, 23 Aug 2016 12:28:19 GMT',
server: 'Apache',
p3p: 'CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"',
'set-cookie': [ 'id=UJm9Wo9HHDOX61490LAN880506;expires=Thu, 22-Sep-2016 12:28:20 GMT;path=/' ],
vary: 'Accept-Encoding',
connection: 'close',
'transfer-encoding': 'chunked',
'content-type': 'text/plain; charset="UTF-8"' }
REQUEST reading response's body
REQUEST finish init function http://localhost:5000/webapi/auth.cgi?a ... 1955298784
REQUEST response end http://localhost:5000/webapi/auth.cgi?a ... 1955298784 200 { date: 'Tue, 23 Aug 2016 12:28:19 GMT',
server: 'Apache',
p3p: 'CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"',
'set-cookie': [ 'id=UJm9Wo9HHDOX61490LAN880506;expires=Thu, 22-Sep-2016 12:28:20 GMT;path=/' ],
vary: 'Accept-Encoding',
connection: 'close',
'transfer-encoding': 'chunked',
'content-type': 'text/plain; charset="UTF-8"' }
REQUEST end event http://localhost:5000/webapi/auth.cgi?a ... 1955298784
REQUEST has body http://localhost:5000/webapi/auth.cgi?a ... 1955298784 61
REQUEST emitting complete http://localhost:5000/webapi/auth.cgi?a ... 1955298784
REQUEST { rejectUnauthorized: true,
jar: true,
json: true,
url: 'http://localhost:5000/webapi/entry.cgi',
qs: { api: 'SYNO.FileStation.Info', version: '1', method: 'get' },
callback: [Function] }
REQUEST make request http://localhost:5000/webapi/entry.cgi? ... method=get
REQUEST onRequestResponse http://localhost:5000/webapi/entry.cgi? ... method=get 200 { date: 'Tue, 23 Aug 2016 12:28:20 GMT',
server: 'Apache',
'cache-control': 'max-age=0, no-cache, no-store, must-revalidate',
pragma: 'no-cache',
expires: '0',
connection: 'close',
'transfer-encoding': 'chunked',
'content-type': 'application/json; charset="UTF-8"' }
REQUEST reading response's body
REQUEST finish init function http://localhost:5000/webapi/entry.cgi? ... method=get
REQUEST response end http://localhost:5000/webapi/entry.cgi? ... method=get 200 { date: 'Tue, 23 Aug 2016 12:28:20 GMT',
server: 'Apache',
'cache-control': 'max-age=0, no-cache, no-store, must-revalidate',
pragma: 'no-cache',
expires: '0',
connection: 'close',
'transfer-encoding': 'chunked',
'content-type': 'application/json; charset="UTF-8"' }
REQUEST end event http://localhost:5000/webapi/entry.cgi? ... method=get
REQUEST has body http://localhost:5000/webapi/entry.cgi? ... method=get 38
REQUEST emitting complete http://localhost:5000/webapi/entry.cgi? ... method=get
[ERROR] : Error: The requested API does not exist
REQUEST { rejectUnauthorized: true,
jar: true,
json: true,
url: 'http://localhost:5000/webapi/auth.cgi',
qs:
{ api: 'SYNO.API.Auth',
version: 3,
method: 'logout',
session: 'SYNO_SESSION_1471955298784' },
callback: [Function] }
The following applies to DSM 6.0.2-8451 Update 4, I don't have any other versions to test.
The authentication API returns {"error":{"code":402},"success":false}
for non-administrator accounts.
To authenticate a non-administrator account, the session
parameter must be set to the desired application's name.
However, I can log with one application, then use another one without having to reauthenticate.
Even better, I can log with an application for which I don't have permission, then use an application for which I do.
For example, even if the user is explicitely denied access to AudioStation, I can log with
/webapi/auth.cgi?api=SYNO.API.Auth&version=3&method=login&account=user&passwd=password&session=AudioStation
Then list the files in my home folder:
syno.fs.list({'folder_path':'/home'}, callback);
But trying use AudioStation's API, which I don't have access to, gets you a Error 115: The logged in session does not have permission
.
For now, I changed session = 'SYNO_SESSION_' + Date.now()
to session = 'FileStation'
in Auth.login
since the FileStation application can't seems to be turned off or removed (easily).
Not pretty but seems to be the simplest solution.
Is it possible to play a song through AudioStation selecting a specified RemotePlayer?
I can correctly view the remote player via syno as listRemotePlayers
, but i can't find a way to play a selected song on the remotePlayer.
Thanks in advance.
$ syno dsm listStorageDisks
result to Error: No parameter of API, method or version
All related to storage APIs will result to the same error message.
With listStorageDisks
command and also turn on --debug
flag, it's appears to use api=SYNO.Core.Storage.Disk&method=list&version=1
to query data, but DSM 6.1.1 changed to use api=SYNO.Storage.CGI.Storage&method=load_info&version=1
and combine all of storages information, aka. iSCSI LUN, Volumes, etc..
According to npm request page (https://www.npmjs.com/package/request), the request package is fully deprecated since some time.
As of Feb 11th 2020, request is fully deprecated.
Please consider moving to a supported http/https package as request will no longer receive any security fixes.
Hi. Thanks for tool. But have some Unknown error when trying to get list of tasks from download station:
$ ./node_modules/.bin/syno --url http://USER:[email protected]:5000 --debug dl getTaskList
[DEBUG] : Params URL detected : http://USER:[email protected]:5000.
[DEBUG] : DSM Connection URL configured : http://USER:[email protected]:5000
[DEBUG] : Account: USER
[DEBUG] : Password: PASSWORD
[DEBUG] : Host: 192.168.0.37
[DEBUG] : Port: 5000
[DEBUG] : API: 6.0
[DEBUG] : Ignore certificate errors: false
[DEBUG] : DSM Download Station API command selected
[DEBUG] : Method name configured : getTaskList
REQUEST { rejectUnauthorized: true,
jar: true,
json: true,
url: 'http://192.168.0.37:5000/webapi/auth.cgi',
qs:
{ api: 'SYNO.API.Auth',
version: 3,
method: 'login',
account: 'USER',
passwd: 'PASSWORD',
session: 'SYNO_SESSION_1478032259136' },
callback: [Function] }
REQUEST make request http://192.168.0.37:5000/webapi/auth.cgi?api=SYNO.API.Auth&version=3&method=login&account= USER&passwd= PASSWORD&session=SYNO_SESSION_1478032259136
REQUEST onRequestResponse http://192.168.0.37:5000/webapi/auth.cgi?api=SYNO.API.Auth&version=3&method=login&account= USER&passwd= PASSWORD&session=SYNO_SESSION_1478032259136 200 { server: 'nginx',
date: 'Tue, 01 Nov 2016 20:20:37 GMT',
'content-type': 'text/plain; charset="UTF-8"',
'transfer-encoding': 'chunked',
connection: 'close',
vary: 'Accept-Encoding',
'x-content-type-options': 'nosniff',
'x-xss-protection': '1; mode=block',
p3p: 'CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"',
'set-cookie': [ 'id=wO12pG8X3GfQQ1470M4N227000;expires=Tue, 08-Nov-2016 20:20:37 GMT;path=/' ] }
REQUEST reading response's body
REQUEST finish init function http://192.168.0.37:5000/webapi/auth.cgi?api=SYNO.API.Auth&version=3&method=login&account= USER&passwd= PASSWORD&session=SYNO_SESSION_1478032259136
REQUEST response end http://192.168.0.37:5000/webapi/auth.cgi?api=SYNO.API.Auth&version=3&method=login&account= USER&passwd= PASSWORD&session=SYNO_SESSION_1478032259136 200 { server: 'nginx',
date: 'Tue, 01 Nov 2016 20:20:37 GMT',
'content-type': 'text/plain; charset="UTF-8"',
'transfer-encoding': 'chunked',
connection: 'close',
vary: 'Accept-Encoding',
'x-content-type-options': 'nosniff',
'x-xss-protection': '1; mode=block',
p3p: 'CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"',
'set-cookie': [ 'id=wO12pG8X3GfQQ1470M4N227000;expires=Tue, 08-Nov-2016 20:20:37 GMT;path=/' ] }
REQUEST end event http://192.168.0.37:5000/webapi/auth.cgi?api=SYNO.API.Auth&version=3&method=login&account= USER&passwd= PASSWORD&session=SYNO_SESSION_1478032259136
REQUEST has body http://192.168.0.37:5000/webapi/auth.cgi?api=SYNO.API.Auth&version=3&method=login&account= USER&passwd= PASSWORD&session=SYNO_SESSION_1478032259136 61
REQUEST emitting complete http://192.168.0.37:5000/webapi/auth.cgi?api=SYNO.API.Auth&version=3&method=login&account= USER&passwd= PASSWORD&session=SYNO_SESSION_1478032259136
REQUEST { rejectUnauthorized: true,
jar: true,
json: true,
url: 'http://192.168.0.37:5000/webapi/entry.cgi',
qs:
{ api: 'SYNO.DownloadStation2.Task.List',
version: '1',
method: 'get' },
callback: [Function] }
REQUEST make request http://192.168.0.37:5000/webapi/entry.cgi?api=SYNO.DownloadStation2.Task.List&version=1&method=get
REQUEST onRequestResponse http://192.168.0.37:5000/webapi/entry.cgi?api=SYNO.DownloadStation2.Task.List&version=1&method=get 200 { server: 'nginx',
date: 'Tue, 01 Nov 2016 20:20:38 GMT',
'content-type': 'application/json; charset="UTF-8"',
'transfer-encoding': 'chunked',
connection: 'close',
vary: 'Accept-Encoding',
'x-content-type-options': 'nosniff',
'x-xss-protection': '1; mode=block',
'cache-control': 'max-age=0, no-cache, no-store, must-revalidate',
pragma: 'no-cache',
expires: '0' }
REQUEST reading response's body
REQUEST finish init function http://192.168.0.37:5000/webapi/entry.cgi?api=SYNO.DownloadStation2.Task.List&version=1&method=get
REQUEST response end http://192.168.0.37:5000/webapi/entry.cgi?api=SYNO.DownloadStation2.Task.List&version=1&method=get 200 { server: 'nginx',
date: 'Tue, 01 Nov 2016 20:20:38 GMT',
'content-type': 'application/json; charset="UTF-8"',
'transfer-encoding': 'chunked',
connection: 'close',
vary: 'Accept-Encoding',
'x-content-type-options': 'nosniff',
'x-xss-protection': '1; mode=block',
'cache-control': 'max-age=0, no-cache, no-store, must-revalidate',
pragma: 'no-cache',
expires: '0' }
REQUEST end event http://192.168.0.37:5000/webapi/entry.cgi?api=SYNO.DownloadStation2.Task.List&version=1&method=get
REQUEST has body http://192.168.0.37:5000/webapi/entry.cgi?api=SYNO.DownloadStation2.Task.List&version=1&method=get 86
REQUEST emitting complete http://192.168.0.37:5000/webapi/entry.cgi?api=SYNO.DownloadStation2.Task.List&version=1&method=get
[ERROR] : Error: Unknown error
REQUEST { rejectUnauthorized: true,
jar: true,
json: true,
url: 'http://192.168.0.37:5000/webapi/auth.cgi',
qs:
{ api: 'SYNO.API.Auth',
version: 3,
method: 'logout',
session: 'SYNO_SESSION_1478032259136' },
callback: [Function] }
I have same error if try to make listFiles
. The only method I get to work is getInfo
.
Just have an idea: could it be related to node.js 7?
I'm trying to use DownloadStation createTask
method but can't manage how to send file. Do you have any example? Is it supported?
Hi, i am currently working on a project to create an smart mirror based on https://github.com/MichMich/MagicMirror.
I want to develop an module which displays the live streams of my cams configured in the Surveillance Station.
The plan is to use your lib to access the DSM but i do not get it work.
To make sure the electron browser is not the problem i installed the lib with command line tool and tried the basic command of the readme.
The curious thing is that the command "syno -u http://USER:PASS@IP:5000 dsm getInfo" works perfectly on my Ubuntu but not on the Raspbian system.
Raspbian:
[ERROR] : Error: No such account or incorrect password
at Request._callback (/usr/local/lib/node_modules/syno/dist/syno.js:79:33)
at Request.self.callback (/usr/local/lib/node_modules/syno/node_modules/request/request.js:185:22)
at Request.emit (events.js:310:20)
at Request.<anonymous> (/usr/local/lib/node_modules/syno/node_modules/request/request.js:1154:10)
at Request.emit (events.js:310:20)
at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/syno/node_modules/request/request.js:1076:12)
at Object.onceWrapper (events.js:416:28)
at IncomingMessage.emit (events.js:322:22)
at endReadableNT (_stream_readable.js:1187:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
code: 400
}
Ubuntu:
{"codepage":"ger","model":"DS216","ram":512,"serial":"XXX","temperature":40,"temperature_warn":false,"time":"Tue Apr 14 11:42:14 2020","uptime":13181841,"version":"24922","version_string":"DSM 6.2.2-24922 Update 4"}
Both systems use Node version: v12.16.2
Ran into this problem when creating a bash script.
#!/bin/sh
echo --- Getting link ---
link=123
echo --- Link aquired ---
SURI="'{"'"uri"'":"'"'"$link"'"'"}'"
echo PhasedURI "$SURI"
syno dl createTask --payload "$SURI"
[ERROR] : JSON Exception : SyntaxError: Unexpected token ' in JSON at position 0
at JSON.parse ()
at execute (/usr/local/lib/node_modules/syno/bin/syno.js:49:20)
at Command. (/usr/local/lib/node_modules/syno/bin/syno.js:292:10)
at Command.listener (/usr/local/lib/node_modules/syno/node_modules/commander/index.js:370:29)
at Command.emit (node:events:513:28)
at Command.parseArgs (/usr/local/lib/node_modules/syno/node_modules/commander/index.js:892:12)
at Command.parse (/usr/local/lib/node_modules/syno/node_modules/commander/index.js:642:21)
at Object. (/usr/local/lib/node_modules/syno/bin/syno.js:353:9)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
It would be awesome if the library supports quickconnect (QC). The problem mainly is that quickconnect first attempts to redirect to the "correct" url.
When making a request e.g. via CLI, the "Connecting..." page gets parsed by syno.js instead of the actual JSON data. Thus, there will be several exceptions while parsing the response.
Maybe it could wait for redirects before parsing the final response data? (https://stackoverflow.com/questions/7323932/how-do-you-follow-an-http-redirect-in-node-js)
Receiving 105
error code even when using the admin account.
var Syno = require('syno');
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
var syno = new Syno({
// Requests protocol : 'http' or 'https' (default: http)
protocol: 'https',
// DSM host : ip, domain name (default: localhost)
host: '192.168.119.203',
// DSM port : port number (default: 5000)
port: '5001',
// DSM User account (required)
account: 'admin',
// DSM User password (required)
passwd: 'password'
});
function callback() {
console.log(arguments);
}
// File Station API - Provide File Station information
syno.fs.getFileStationInfo(callback);
// The above API call returns:
//{ '0': null,
// '1':
// { hostname: 'DiskStation',
// is_manager: true,
// support_sharing: true,
// support_vfs: true,
// support_virtual: 'cifs,iso' } }
// File Station API - Enumerate files in a given folder
syno.fs.listFiles({'folder_path':'/volume1/photo/'}, callback);
// The above API call returns:
// { '0': { [Error: The logged in session does not have permission] code: 105 } }
Found a similar issue at http://forum.synology.com/enu/viewtopic.php?f=223&t=76514 where the user said "I wasn't passing the Session ID by using GET".
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.