Browsing the forum I found related questions:
I want a (python) script on Machine A to read and process files in a folder that is shared with other machines. At the start of the script, I want to check, maybe even block, if there are changes on the other machines that are not yet copied to Machine A.
One of the above questions mentions GET /rest/db/completion. I tried that (through the python API) by deleting a large number of files on one of the other machines, Machine B, and calling /rest/db/completion on Machine A’s syncthing instance with the folder ID and the machine id of both Machine A and Machine B. With the ID of Machine B it always returned 100, with the ID of Machine A it always returned 0. In the web GUI for Machine A I could see the status updating as it synchronized the file changes from Machine B. Something obviously isn’t working.
I tried /rest/db/status and it does show the state has changed form idle to syncing, so maybe that’s enough The completion percentage would be nice for user feedback though, and less output to deal with.
Is there a better way to do this? I’m not a REST expert and the discussion of the rest/events/ API in the above two threads didn’t quite make sense to me, but is that the way I should be going?