I am creating some folders and later sharing them with the remote device. Is there an API call present which will give me all the unshared local folders in syncthing.
Iām honestly not sure about a specific one to give you the desired result natively. So perhaps someone has better input.
There is a /rest/config/folders
endpoint which should give you all the folder configurations at least. There you can filter the output based on anything you want. For non-shared folders, I supposed that would be a devices-array with a length of 1 (only the local instance).
So a cli command like;
curl -X GET -H "X-API-Key: someapikey" http://localhost:8384/rest/config/folders | jq '.[] | select(.devices | length == 1) | .id'
would give you the folder ids of the non-shared folders. This implies having jq installed, which I have on Mac. But I suppose for other OSes there must be something similar.
If my syncthing is currently containing 10,000 files this device array check can be an expensive call which can increase the CPU utilization if called again and again. Is there another better approach to check unshared files ?
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.