Hi
I need to get the DeviceID of the local Syncthing instance from a shell script.
I was able to do it via REST API:
BASEURL='http://localhost:8384/rest'
APIKEY='xxxxxxxxxxxxxxxxxxxxxxxxxxx'
curl --silent --header "X-API-Key: $APIKEY" $BASEURL/system/status |
jq '(.myID | split("-")[0]) as $short_id | { full_id: .myID, short_id: $short_id }'
Sample output:
{
"full_id": "63XRPVV-SRQRZAF-LMQ2C3M-BXJHTZA-KA9CHHE-2EAQ3PU-POFDYNW-JFYEVBN",
"short_id": "63XRPVV"
}
Just wondering if this is “correct” or if there’s a more concise way to do it that doesn’t require jq
…