Guidance on using the API to add and accept devices and folders

Hi,

I’m putting together a simple-ish syncthing based backup between a couple of nodes, and I’m standing it up using Ansible.

I’ve started the build using this Ansible playbook as a basis (but the variables it’s using for mapping is quite complex, so I’m rewriting that bit), and I’m now trying to work out how the dance-of-device-adding-and-acceptance will work out.

Using the WebUI, I would, assuming two nodes, do this:

Node1: Start SyncThing (shortid=node1)
Node1: Configure folder for sharing (shortid=dir1)
Node2: Start SyncThing (shortid=node2)
Node1: Add remote device: node2
            share folder: dir1
Node2: Accept remote device: node1
Node2: Accept remote folder: dir1

Via the RestAPI (or, for that matter, with a config file), do I:

Node1: Start SyncThing (shortid=node1), pass ID to automater
Node2: Start SyncThing (shortid=node2), pass ID to automater
Node1: Define all <device> nodes and <folder> nodes in the config
Node2: Define all <device> nodes and <folder> nodes in the config
Node1: Restart Syncthing
Node2: Restart Syncthing

Or, have I got it all wrong? :slight_smile:

I would suggest pushing the new config using the API, and then not doing a restart as it shouldn’t be necessary. But otherwise, yes that sounds about right.

1 Like