Filebot Node curl for tasks and SynoAPI

Support for Synology NAS, QNAP NAS and other Embedded Linux systems
Post Reply
macdis
Posts: 4
Joined: 02 Dec 2022, 22:36

Filebot Node curl for tasks and SynoAPI

Post by macdis »

Hi. I have a Synology DS220+ running DSM 7.1.1-42962 and the Filebot Node package.

Is it possible to fully automate (i.e., make non-interactive) the process of running a Filebot task from within a Docker container?

For example, I was wondering how the curl command for running Filebot tasks is automatically formed within Filebot Node. Specifically, how does Filebot Node generate a correctly-formed curl command with cookie id and synotoken?

The general idea is that I'd like to automate the generation of a correctly formed curl command on the fly for use in a Docker container, outside of an active login session, if that's possible. After reading up on it a bit, I figure that I can script the necessary API calls but that does not seem very secure or "the right way" to go about this. If I'm going to go that route, maybe it's better to use a FileBot Node Docker container.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Filebot Node curl for tasks and SynoAPI

Post by rednoah »

FileBot Node for DSM will always require a DSM login session and the session cookies for that of course cannot be known outside that login session. You can only know the login session by already being logged in with your browser and checking the request headers, or by pretending to be a browser and doing a username and password login, though DSM will probably try to prevent your non-human login requests.


:idea: FileBot Node knows your Cookies and X-Syno-Token because your browser is sending that information along with every request for authentication purposes:
https://github.com/filebot/filebot-node ... pp.js#L782


:arrow: If you're already using a docker container, then you might as well use another docker container for FileBot Node, so that you can use no authentication or HTTP "Basic" authentication for convenience.
:idea: Please read the FAQ and How to Request Help.
macdis
Posts: 4
Joined: 02 Dec 2022, 22:36

Re: Filebot Node curl for tasks and SynoAPI

Post by macdis »

Cool, thanks! That's kind of what I thought the answer would be. For those interested, the Developer's Guide for DSM Login Web API details how a non-human, automated login and logout can work and I did use it experimentally to generate the curl calls to run FileBot tasks. It worked. But I didn't pursue that avenue further because I didn't want to deal with passing passwords in scripts. For my use case, the Filebot Node Docker container works fine.
Post Reply