How to determine if files are in sync using API

I am wondering if there is a way to check if all the files are in sync (condition) using the REST API

The API:

https://docs.syncthing.net/dev/rest.html

A similar discussion from the other day:

Thanks for the information. I have read the REST API document and also the thread you mentioned. Will this:

curl http://localhost:8384/rest/events?events=FolderCompletion;timeout=3; if it returns [] (empty), it means that all files are in sync, assuming I have only one folder (otherwise append folder=xxx in the API call)

be a good way to check if files are in sync (local files)?

One more question: when I tried to use the REST API call, how to specify device and other parameters? The API Document is not very clear on this. for example I try to filter the information for only one device: curl -X GET -H “X-API-Key:xxdfadfasf” http://localhost:8384/rest/events?events=FolderCompletion;device=XXXX-YYYYY;since=lastSeenID

the returned results seem not for device XXXX-YYYY, but all devices were shown; since last seen ID also seems not working.

It looks like youre formatting the URL parameters wrong. You need to use & instead of ;

The event stream does not work like you are assuming. It is a continuous stream of events, filtered only by event type.

Of course I tried & instead of ;, but through my test it does not work with &. Funny thing is , I tried using ; instead of &, it worked.


So, Only ?events=XXXX is supported in the API, and we have to check the returned information for details (such as which folder/device the event is for)?

Sorry for bugging you, Just couldn’t read it out from the docs.