Hmm, its clearly my lack of experience here.
Ok I learned how to put the entire config:
Get config:
curl -k -X GET -H "X-API-Key: ZjpQ5U7gaXdjYttzikzvZvtwPHaUnqvj" https://localhost:8384/rest/config > config.json
PUT config:
curl -k -X PUT -H "X-API-Key: ZjpQ5U7gaXdjYttzikzvZvtwPHaUnqvj" https://localhost:8384/rest/config -d @config.json
Get pending folders:
curl -k -X GET -H "X-API-Key: ZjpQ5U7gaXdjYttzikzvZvtwPHaUnqvj" https://localhost:8384/rest/cluster/pending/folders
{
"kmmgl-nygfm": {
"offeredBy": {
"Z2M6GO2-455NXSO-CQLJVBB-IIG5MPA-ERT636W-LUK3GUC-MUSIBP6-6UIVQQF": {
"time": "2021-10-20T18:18:40Z",
"label": "syncthing-restAPI",
"receiveEncrypted": false,
"remoteEncrypted": false
}
}
}
}
Doesnt seem to be a simple way to add this folder to the config – other than manually do it and then add a bunch of other parameters. In terms of other parameters, my folders have the following structure:
$ curl -k -X GET -H "X-API-Key: ZjpQ5U7gaXdjYttzikzvZvtwPHaUnqvj" https://localhost:8384/rest/config/folders
[
{
"id": "default",
"label": "Default Folder",
"filesystemType": "basic",
"path": "/home/kevdog/Sync",
"type": "sendreceive",
"devices": [
{
"deviceID": "Z2M6GO2-455NXSO-CQLJVBB-IIG5MPA-ERT636W-LUK3GUC-MUSIBP6-6UIVQQF",
"introducedBy": "",
"encryptionPassword": ""
},
{
"deviceID": "4UGYVUF-5Q52M6L-BAXWG3H-CBNO2TC-HOWE6ZM-NJAZDNT-OTP7FOR-VZUP6AS",
"introducedBy": "",
"encryptionPassword": ""
}
],
"rescanIntervalS": 3600,
"fsWatcherEnabled": true,
"fsWatcherDelayS": 10,
"ignorePerms": false,
"autoNormalize": true,
"minDiskFree": {
"value": 0,
"unit": ""
},
"versioning": {
"type": "",
"params": {},
"cleanupIntervalS": 3600,
"fsPath": "",
"fsType": "basic"
},
"copiers": 0,
"pullerMaxPendingKiB": 0,
"hashers": 0,
"order": "random",
"ignoreDelete": false,
"scanProgressIntervalS": 0,
"pullerPauseS": 0,
"maxConflicts": -1,
"disableSparseFiles": false,
"disableTempIndexes": false,
"paused": false,
"weakHashThresholdPct": 25,
"markerName": ".stfolder",
"copyOwnershipFromParent": false,
"modTimeWindowS": 0,
"maxConcurrentWrites": 2,
"disableFsync": false,
"blockPullOrder": "standard",
"copyRangeMethod": "standard",
"caseSensitiveFS": false,
"junctionsAsDirs": false
},
{
"id": "uxdnc-gkngr",
"label": "SyncthingTestFolder",
"filesystemType": "basic",
"path": "/home/kevdog/SyncthingTestFolder",
"type": "sendreceive",
"devices": [
{
"deviceID": "Z2M6GO2-455NXSO-CQLJVBB-IIG5MPA-ERT636W-LUK3GUC-MUSIBP6-6UIVQQF",
"introducedBy": "",
"encryptionPassword": ""
},
{
"deviceID": "4UGYVUF-5Q52M6L-BAXWG3H-CBNO2TC-HOWE6ZM-NJAZDNT-OTP7FOR-VZUP6AS",
"introducedBy": "",
"encryptionPassword": ""
}
],
"rescanIntervalS": 3600,
"fsWatcherEnabled": true,
"fsWatcherDelayS": 10,
"ignorePerms": false,
"autoNormalize": true,
"minDiskFree": {
"value": 1,
"unit": "%"
},
"versioning": {
"type": "",
"params": {},
"cleanupIntervalS": 0,
"fsPath": "",
"fsType": "basic"
},
"copiers": 0,
"pullerMaxPendingKiB": 0,
"hashers": 0,
"order": "random",
"ignoreDelete": false,
"scanProgressIntervalS": 0,
"pullerPauseS": 0,
"maxConflicts": 10,
"disableSparseFiles": false,
"disableTempIndexes": false,
"paused": false,
"weakHashThresholdPct": 25,
"markerName": ".stfolder",
"copyOwnershipFromParent": false,
"modTimeWindowS": 0,
"maxConcurrentWrites": 2,
"disableFsync": false,
"blockPullOrder": "standard",
"copyRangeMethod": "standard",
"caseSensitiveFS": false,
"junctionsAsDirs": false
}
]
Seems like there should be an easy route to add a folder but apparently there isn’t. Seems like my workflow here is going to be GET folders, query pending folders/endpoints, generate json manually to add folder modifying path and any other parameters, use POST method to add folder.
**Confirmed this method to work although its clunky. Get an existing folder object so I can use it as baseline for new folder:
curl -k -X GET -H "X-API-Key: ZjpQ5U7gaXdjYttzikzvZvtwPHaUnqvj" https://localhost:8384/rest/config/folders/uxdnc-gkngr > test2.json
Modify test2.json changing id, label and path (and optionally anything else if needed).
Post the Object back:
curl -k -X POST -H "X-API-Key: ZjpQ5U7gaXdjYttzikzvZvtwPHaUnqvj" https://localhost:8384/rest/config/folders -d @test2.json
Sync worked. Cool stuff I suppose.