REST API

I have a task in Syncthing I would like to have automated, and I’ve been told I can use the REST API for it. I would like Syncthing to automaticly revert a receive only folder, this is the API string that should run to execute a revert on the local Syncthing. I cannot seem to get it to work, can anyone help with how to get this to run as a scheduled task on a Windows 2022 server?

curl -X POST -H X-API-Key:… http://127.0.0.1:8384/rest/db/revert?folder=default

Sounds like a perfect task for your favorite AI chat bot? Sorry I cannot answer from the top of my head.

Did you run it successfully on the command line, without task scheduler?

1 Like

I suspect folder=default may be the culprit.

1 Like

Thanks, that was exactly what was wrong, it is even written in the documentation I linked. I will have to read it twice next time.

For anyone interested, this is the powershell script I will be scheduling.

> $headers = @{
>     "X-API-Key" = "API KEY"
> }
> 
> $response = Invoke-RestMethod -Uri "http://127.0.0.1:8384/rest/db/revert?folder=FOLDER ID" `
> -Method Post `
> -Headers $headers
> 
> $response
1 Like