-
Notifications
You must be signed in to change notification settings - Fork 13
synology api
Yannick Croissant edited this page Aug 16, 2013
·
2 revisions
GET /webapi/auth.cgi
Authentication method.
Parameter | Mandatory | Default value | Description |
---|---|---|---|
api |
Y | Method ID: SYNO.API.Auth
|
|
version |
Y | Version of the api to use. Possible values: 1 , 2 . |
|
method |
Y | Method to use. Possibles values: login
|
|
account |
Y | Login account name | |
passwd |
Y | Login account password | |
session |
Y | Login session name | |
format |
cookie |
Returned format of session ID. Following are the two possible options. cookie : The login session ID will be set to cookie. sid : The login sid will only be returned as response json data and the cookie will not be set. |
|
otp_code |
This option is not required to login currently. However, please note that DSM 4.2 and later includes a 2-step verification option. If enabled, the user requires a verification code to log in to DSM sessions. |
var Synology = require('synology');
var syno = new Synology();
syno.query({
path: '/webapi/auth.cgi',
params: {
api: 'SYNO.API.Auth',
version: 2,
method: 'login',
account: 'mylogin',
passwd: 'mypassword',
session: 'session' + Math.round(Math.random() * 1e9),
format: 'sid'
}
}, function(err, data) {
if (err) throw err;
console.log(data);
});
{
"data": {
"sid": "5uBDokPa1jb9F"
},
"success": true
}
?????
GET /webapi/query.cgi
Provides available API info.
Parameter | Mandatory | Default value | Description |
---|---|---|---|
api |
Y | Method ID: SYNO.API.Info
|
|
version |
Y | Version of the api to use. Possible values: 1 . |
|
method |
Y | Method to use. Possibles values: query
|
|
query |
ALL |
API names concatenated by , or use ALL to get all supported APIs. |
var Synology = require('synology');
var syno = new Synology();
syno.query({
api: 'SYNO.API.Info',
version: 1,
method: 'query',
query: 'SYNO.API.Info,SYNO.API.Auth'
}, function(err, data) {
if (err) throw err;
console.log(data);
});
{
"data": {
"SYNO.API.Auth": {
"maxVersion": 3,
"minVersion": 1,
"path": "auth.cgi"
},
"SYNO.API.Info": {
"maxVersion": 1,
"minVersion": 1,
"path": "query.cgi"
}
},
"success": true
}