Skip to content

Instantly share code, notes, and snippets.

import requests #request library is to send HTTP requests
url_system_status = "http://127.0.0.1:8384/rest/system/config"
#according to the documentation of Syncthing,/rest/system/config exposes configuration details
headers= {"X-API-Key" : "XXXXXXXXXXX"}
"""
headers is for authentication. Syncthing REST API exposes the end points via API Key
API key can be found at Syncthing GUI --> Actions --> Settings
import requests
url_system_status = "http://127.0.0.1:8384/rest/system/config"
headers= {"X-API-Key" : "XXXXXXX"}
contents = open('config_edited.json', 'rb').read()
post_data = requests.post(url_system_status,headers=headers,data=contents)
version 28
folders [{'id': '99ske-maske', 'label': '1', 'filesystemType': 'basic', 'path': 'R:\\1', 'type': 'readwrite', 'devices': [{'deviceID': 'KEDUFUO-', 'introducedBy': ''}, {'deviceID': 'KW23ASQ-', 'introducedBy': ''}], 'rescanIntervalS': 60, 'fsWatcherEnabled': False, 'fsWatcherDelayS': 10, 'ignorePerms': False, 'autoNormalize': True, 'minDiskFree': {'value': 1, 'unit': '%'}, 'versioning': {'type': '', 'params': {}}, 'copiers': 0, 'pullers': 0, 'hashers': 0, 'order': 'random', 'ignoreDelete': False, 'scanProgressIntervalS': 0, 'pullerPauseS': 0, 'maxConflicts': 10, 'disableSparseFiles': False, 'disableTempIndexes': False, 'paused': False, 'weakHashThresholdPct': 25, 'markerName': '.stfolder'}]
devices [{'deviceID': 'KEDUFUO', 'name': 'LAP1', 'addresses': ['dynamic'], 'compression': 'metadata', 'certName': '', 'introducer': False, 'skipIntroductionRemovals': False, 'introducedBy': '', 'paused': False, 'allowedNetworks': [], 'autoAcceptFolders': False}, {'deviceID': 'KW23ASQ', 'name': '', 'addresses': ['