Apologies if “Development” is the wrong category. Since the REST and Events APIs are documented under “Development” in the docs, it seemed appropriate.
I am writing a UI which allows the user to connect to remote machines without the user of the Syncthing GUI. It’s following these steps:
- Find nearby devices:
/rest/system/discovery
- Connect to a device:
/rest/config/devices
(POST
)
I don’t see a way to find out the Device Name of the discovered device prior to connecting the device. However, if I choose an arbitrary name for the POST, Syncthing then thinks that’s what I want as a Device Name. If I leave the ‘name’ key blank in the POST, Syncthing displays the first 7 letters of the Device ID (in the GUI) instead of using the hostname and returns "name": ""
from GETs to /rest/config/devices
.
Using only the API, is there a way to get the correct Device Name (as Syncthing would display under normal circumstances) from the discovery API or to patch a connected device, shortly after connecting to it, with its correct name? The user won’t have any access to the Syncthing GUI or CLI.
Since this is only for informational/display purposes, the Device ID isn’t helpful to the user, as it doesn’t have any meaning to them.
Apologies if I overlooked something in the documentation; the API is really thorough, so I was quite surprised when I couldn’t figure out how to do this. I figured I would ask here before reading through the Syncthing source, since I’d prefer not to replicate behaviour Syncthing already provides.
Thanks so much!