kwent / syno

Simple Node.js wrapper and CLI for Synology DSM REST API 5.x and 6.x.
http://kwent.github.io/syno
MIT License
319 stars 51 forks source link

How Call additional ? #51

Closed Afondevi closed 4 years ago

Afondevi commented 4 years ago

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

kwent commented 4 years ago

Hi,

Does not sound like a syno.js issue. Have you tried a curl request instead to see the answer ?

Regards

Afondevi commented 4 years ago

With this code :

static test(req, res){
  syno.fs.list({
    folder_path: "/WebResources",
    additional: "time"
  }, (error, architecture) => {
    if (error) {
      res.json(error);
    }
    res.json(architecture);
  });
}

get this output :

{
    "files": [
        {
            "additional": {
                "time": {
                    "atime": 1587208664,
                    "crtime": 1586976463,
                    "ctime": 1587065734,
                    "mtime": 1586977749
                }
            },
            "isdir": true,
            "name": "my folder",
            "path": "/WebResources/my folder"
        },
        ...
    ],
    "offset": 0,
    "total": 12
}

if I replace additional: "time" by additional: "time,real_path,size" => get that :

{
    "files": [
        {
            "isdir": true,
            "name": "my folder",
            "path": "/WebResources/my folder"
        },
        ...
    ],
    "offset": 0,
    "total": 12
}
jensstigaard commented 4 years ago

I have same issue.. I can only request one field using the additional parameter.. I suspect it to be a Synology problem, since I experience the same if I use the direct url.. The official API suggests %2C (unicode for ,) as a delimiter. But that doesn't work either.

kwent commented 4 years ago

@jensstigaard @Afondevi I don't think i can do much. I would contact Synology support and see what they are thinking.