REST API: rest/system/pause?FOLDER functionality - Does it exist or how to implement?

I have a group of servers running Syncthing and am writing some scripts for monitoring and controlling the group. I found most of the functionality I was looking for except the ability to pause individual folders via the API. From what I have been able to gather from other posts and feature requests is that this was never fully implemented for the API after the capability was added to the GUI.

My question is how can I pause/un-pause individual folders via the REST API or some other CLI method that can be automated? If I have to get/set the whole config I can do that if someone would point me in the right direction.

Folder pausing is handled differently, for reasons… You need to do full a config POST with a "paused": true in the folder object.

Ok, so my process would look like:

-GET /rest/system/config -Parse results and find the folder(s) I am interested in -Append “paused”: true to folder -POST /rest/system/config -Restart Syncthing Service?

I was disappointed that the documentation mentioned that a restart of Syncthing is required to apply the updated config, I understand how that is a good idea in general for any config changes but my original idea was to pause a folder without interrupting the rest of the service.

Thanks for pointing me in the right direction. It isn’t quite as simple as I was hoping, but I think I can make it work.

I don’t think pause requires a restart. There is very little left these days that requires a restart

Restart isn’t necessary. I’m doing exactly that on my Android to disable certain folders when I’m not connected to my home Wifi.

Wouldn’t it be consistent to have the same pause/resume endpoints for folders as with devices? For backwards compatibility, maybe call them pauseFolder/resumeFolder and keep pause/resume for devices. This should be trivial to add. Any reasons not to?

There was a discussion of this in the PR. I think the executive summary is that we got tired of discussing it and left an API overhaul for another day.

My Syncthing Tray also provides a small CLI application called syncthingctl which can pause/un-pause individual folders.

Eg.

syncthingctl pause --dir docs-fh --dir docs-misc --dev martchus-server

will pause the directories docs-fh and docs-misc and the device martchus-server.

Of course it is also possible to resume. Internally it is using the approach @calmh described.

Due to the lack of documentation about this inconsistency I had to ask the same question when developing the tool just to be sure I didn’t miss anything.