Overview
Device names allow you to assign custom, human-friendly names to devices based on their serial numbers. These names are separate from saved device labels and persist across connections.Device names are keyed by serial number (for both USB and wireless devices), while saved devices are keyed by IP address (wireless only).
GET /api/device-names
Get all custom device names.Response
Object mapping device serial numbers to custom names
- Key: Device serial number
- Value: Custom name string
Example Request
Example Response
PUT /api/device-names/:serial
Set or update a custom name for a device.Path Parameters
Device serial number (must be URL-encoded if it contains special characters like
:)Examples:- USB device:
ABC123456789 - Wireless device:
192.168.1.100:5555(encode as192.168.1.100%3A5555)
Request Body
Custom device name (will be trimmed of whitespace)
Response
Always returns
trueExample Request
Example Response
Error Response
Returns400 if name is missing or empty:
DELETE /api/device-names/:serial
Remove a custom name for a device.Path Parameters
Device serial number (must be URL-encoded if it contains special characters)
Response
Always returns
true (even if the serial doesn’t exist)Example Request
Example Response
Usage in Device Lists
Custom names are automatically included in device list responses from/api/devices:
customName field will be:
- The custom name if one is set
nullif no custom name exists
UI Implementation Example
Difference from Saved Device Labels
Device Names (this API)
- Key: Serial number (USB or wireless)
- Scope: All devices (USB and wireless)
- Purpose: Custom names for device identification
- Appears in:
/api/devicesresponse ascustomNamefield - Storage:
device-names.json
Saved Device Labels
- Key: IP address + port
- Scope: Wireless devices only
- Purpose: Quick reconnection to wireless devices
- Appears in:
/api/saved-devicesresponse aslabelfield - Storage:
devices.json
Example Scenario
A wireless device at192.168.1.100:5555 with serial ABC123 can have:
- Custom name:
"John's Phone"(set via/api/device-names/ABC123) - Saved device label:
"Samsung Galaxy S21"(set via/api/saved-devices)
/api/devices:
Storage
Device names are stored in:- File:
device-names.jsonin the server directory - Format: JSON object with serial numbers as keys
- Persistence: Survives server restarts
- Cache: Loaded into memory on first access
device-names.json:
