I’m having issues with configuring the FsWatcherEnabled flag in the config via the REST API.
I’m using Ansible to manage an install of Syncthing as a part of a larger suite of software. I’m able to configure most of it correctly via the REST API. I’m able to add devices and folders correctly without an issue.
When setting the fsWatcherEnabled flag via Ansible, it doesn’t enable it in the config API response. I’ve restarted the Syncthing instance after the attempt with no success. I still have to go into the UI and enable it.
However, if I use Insomnia to manually send the JSON string and restart, it correctly configures the flag.
In fairness, I’m not seeing fsWatcherEnabled in the REST API documentation. However, if it weren’t configurable via API, then I wouldn’t be able to use Insomnia to send the JSON string.
I can post the Ansible code; however, I’m not sure if it would be of any help. I’ve looked at the Ansible echos and the flag is being sent, apparently correctly.
I realize you don’t support Ansible in any fashion. However, here, it shouldn’t be an issue since all Ansible is doing is commanding each server to perform an action. The action here is a curl to localhost:8384 with the appropriate API key in the headers and a JSON payload.
Any assistance you can provide would be much appreciated.
It’s on the folder in the config: https://docs.syncthing.net/users/config.html#folder-element
Post the config via the API. It’s what the GUI does.
That’s what I’ve been doing, posting it under the api for each folder element. It works when I do it for Insomnia, but not for a curl. That’s why I’m so confused. I’m still looking independently, but any guidance would be appreciated.
There really isn’t much to guide. The config is a JSON blob. You get it from /rest/system/config, modify it (docs linked above), and POST it back to the same place.
I think I’ve figured out the problem. I was using the wrong version of the configuration JSON string. I was using version 15 and mine returns version 28 via the GET. Apparently, there are some big differences between what is in the documentation and what the API returns.
On a side note, if anybody is interested, I would be happy to provide a copy of the j2 template and Ansible play that I’m using to generate this. The Syncthing via Ansible is sparse and I can hope it helps anybody else.
If I was you, I’d do a get, mutate certain part you care about with JQ, and post back.
Thanks, I looked at that; however, Ansible is a little kooky and doesn’t really support JSON. using a j2 template is a work around that was suggested. I’ll keep looking at it.
Ansible does not need to support json, jq does.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.