Skip to content

Commit

Permalink
TIL: pause/resume folder syncing with the syncthing API
Browse files Browse the repository at this point in the history
  • Loading branch information
pew committed Feb 8, 2025
1 parent 23f7130 commit 39eefdf
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions man/syncthing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
date created: Saturday, February 8th 2025, 9:52:40 am
date modified: Saturday, February 8th 2025, 9:57:06 am
tags:
---

# syncthing

## get folder label and id

this will create an output like this: `my-folder: foo-id`

```shell
curl -s -H "Authorization: Bearer your-api-key-here" https://syncthing.example.com/rest/config | jq -r '.folders[] | "\(.label): \(.id)"'
```

## pause / resume folder sync

I use this with home-assistant to pause/resume folder syncing to avoid starting up my NAS drives when syncthing does a rescan. Replace `your-folderID` at the end of the url with the ID of your folder (see [get folder label and id](#get%20folder%20label%20and%20id))

**pause syncthing:**

```shell
curl -s -H "Authorization: Bearer your-api-key-here" -H "content-type: application/json" -X PATCH -d '{"paused": true}' https://syncthing.example.com/rest/config/folders/your-folderID
```

**resume syncthing:**

```shell
curl -s -H "Authorization: Bearer your-api-key-here" -H "content-type: application/json" -X PATCH -d '{"paused": false}' https://syncthing.example.com/rest/config/folders/your-folderID
```

0 comments on commit 39eefdf

Please sign in to comment.