How to delete folder with REST API

Hey Guys, in my application it’s possible to have thousands of shared folders. What’s the best approach to deleting individual folders with the REST API?

Note: The docs say to “PUT” the full config JSON object back (with removed folder object) but this seems like a really inefficient way to remove folders?

Thanks in advance

It’s not documented, but it seems

does support DELETE:

Yeah, good point !!!

I was just expecting some type of “/rest/config/folders/delete=” API call?

Maybe something will be available in a future release ?

Hmm, I just tried a GET of “/rest/config/folders”, removed a folder from the JSON array and PUT the modified JSON back … but it appears that the folder was not removed !!!

Trying a few other things …

That would be a DELETE on /rest/config/folders/<folder-id>.

PUT on /rest/config/folders merges existing folders with the given folders, i.e. doesn’t remove any.

Thanks for the response Simon.

So would a CURL DELETE on /rest/config/folders/ work you think?

I tried this and appears to work:

  1. GET “/rest/config” object
  2. Remove folder in question from “folders” JSON array
  3. PUT back “/rest/config” object

I’ll have to protect this logic with a mutex but should work !!

BTW, is the Synching REST API thread safe ? (from application’s point of view)


That’s what I tried to express with this:

Can you please explain, where the uncertainty is coming from.

It is technically thread safe, however if you have a lot of requests outstanding in parallel, the config changes aren’t necessarily applied in the order you sent off the request. Internally there is a queue, if you manage to have more than 1000 outstanding modifications, further modifications will result in an error.

Hey Simon,

Sorry, I understand what you meant by DELETE now :slight_smile:

I just tried a CURL request using DELETE and it works great !!!

BTW, we’re completely integrating Syncthing into our product (SquidNet Render Manager:

Thanks for the awesome help !!!