mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-08-19 00:56:16 +00:00
Completes the implementation of all official Bose SoundTouch Web API v1.0
endpoints, achieving 100% official API coverage.
## New Features
### DSP Audio Controls (/audiodspcontrols)
- GetAudioDSPControls() - Get current DSP settings and supported audio modes
- SetAudioDSPControls() - Set audio mode and video sync delay
- SetAudioMode() - Set audio mode only (NORMAL, DIALOG, MUSIC, MOVIE, etc.)
- SetVideoSyncAudioDelay() - Set video sync delay only
### Advanced Tone Controls (/audioproducttonecontrols)
- GetAudioProductToneControls() - Get advanced bass/treble settings with ranges
- SetAudioProductToneControls() - Set both bass and treble
- SetAdvancedBass() - Set advanced bass level only
- SetAdvancedTreble() - Set advanced treble level only
### Speaker Level Controls (/audioproductlevelcontrols)
- GetAudioProductLevelControls() - Get front-center and rear-surround levels
- SetAudioProductLevelControls() - Set both speaker levels
- SetFrontCenterSpeakerLevel() - Set front-center speaker level only
- SetRearSurroundSpeakersLevel() - Set rear-surround speakers level only
## Implementation Details
### Models & Validation
- Complete XML marshaling/unmarshaling with proper struct separation
- Comprehensive input validation with device capability checking
- Support for device-specific ranges and step values
- Proper error handling and constraint validation
### CLI Integration
- Full CLI command tree: audio -> {dsp,tone,level} -> {get,set,specific}
- Rich help text with device-specific guidance
- Flexible parameter handling (individual or combined operations)
- Professional usage examples and CLI command demonstrations
### Testing Coverage
- 748+ lines of comprehensive model tests
- 786+ lines of client integration tests
- XML marshaling/unmarshaling validation
- Error handling and edge case coverage
- Network error simulation and validation testing
## Device Compatibility
### Consumer Devices (SoundTouch 10, 20, 30)
- ✅ Basic controls (bass, volume, balance)
- ❌ Advanced audio controls (professional feature)
### Professional/High-end Devices
- ✅ All basic controls
- ✅ DSP audio modes and video sync
- ✅ Advanced bass/treble controls
- ✅ Speaker level controls (surround systems)
## Documentation & Examples
### Updated Coverage Documentation
- README.md: Updated to 100% complete (19/19 endpoints)
- API-Endpoints-Overview.md: Complete coverage analysis
- API-COVERAGE-ANALYSIS.md: Achievement of full API implementation
### Comprehensive Examples
- advanced-audio-controls.go: Complete usage demonstration
- CLI command examples and device compatibility guide
- Error handling and validation examples
## Final API Status
- ✅ **19/19 Official Endpoints Implemented** (100%)
- ✅ **18/19 Functional on Real Devices** (95%)
- ❌ **1 Endpoint Non-functional** (/trackInfo times out on hardware)
- 🔍 **5 Extended Features** (beyond official API v1.0)
This completes the most comprehensive Bose SoundTouch API implementation
available, covering all documented endpoints plus extended functionality.
405 lines
12 KiB
Markdown
405 lines
12 KiB
Markdown
# Bose SoundTouch Web API - Endpoints Overview
|
|
|
|
This document provides a comprehensive overview of the available API endpoints verified against the official Bose SoundTouch Web API v1.0 specification (January 7, 2026).
|
|
|
|
## Implementation Status Legend
|
|
- ✅ **Implemented** - Fully implemented with tests and real device validation
|
|
- ❌ **Missing** - Documented in official API but not implemented
|
|
- 🔍 **Extra** - Implemented but not in official API v1.0 (may be newer version or undocumented)
|
|
- ⚠️ **Different** - Implemented with different approach than official API
|
|
|
|
## API Basics
|
|
|
|
- **Protocol**: HTTP REST-like
|
|
- **Data Format**: XML Request/Response
|
|
- **Standard Port**: 8090
|
|
- **Base URL**: `http://<device-ip>:8090/`
|
|
- **Authentication**: No complex authentication required
|
|
- **Real-time Updates**: WebSocket connection available
|
|
|
|
## Device Information
|
|
|
|
### GET /info ✅ **Implemented**
|
|
Retrieves basic device information.
|
|
|
|
**Response XML Structure:**
|
|
```xml
|
|
<info deviceID="..." type="..." name="..." ...>
|
|
<name>Device Name</name>
|
|
<type>Device Type</type>
|
|
<margeAccountUUID>UUID</margeAccountUUID>
|
|
<components>...</components>
|
|
</info>
|
|
```
|
|
|
|
## Playback Control
|
|
|
|
### GET /now_playing ✅ **Implemented**
|
|
Retrieves information about the currently playing music.
|
|
|
|
**Response XML Structure:**
|
|
```xml
|
|
<nowPlaying deviceID="..." source="...">
|
|
<ContentItem source="..." type="..." location="..." sourceAccount="...">
|
|
<itemName>Track Name</itemName>
|
|
<containerArt>Album Art URL</containerArt>
|
|
</ContentItem>
|
|
<track>Track Name</track>
|
|
<artist>Artist Name</artist>
|
|
<album>Album Name</album>
|
|
<stationName>Station Name</stationName>
|
|
<art artImageStatus="...">Art URL</art>
|
|
<playStatus>PLAY_STATE</playStatus>
|
|
<shuffleSetting>...</shuffleSetting>
|
|
<repeatSetting>...</repeatSetting>
|
|
</nowPlaying>
|
|
```
|
|
|
|
### POST /key ✅ **Implemented**
|
|
Sends key commands to the device.
|
|
|
|
**Important**: Proper key simulation requires sending both press and release states:
|
|
|
|
**Request XML (Press + Release):**
|
|
```xml
|
|
<key state="press" sender="Gabbo">KEY_NAME</key>
|
|
<key state="release" sender="Gabbo">KEY_NAME</key>
|
|
```
|
|
|
|
**Available Keys:**
|
|
|
|
**Playback Controls:**
|
|
- `PLAY` - Start playback
|
|
- `PAUSE` - Pause current playback
|
|
- `STOP` - Stop current playback
|
|
- `PREV_TRACK` - Go to previous track
|
|
- `NEXT_TRACK` - Go to next track
|
|
|
|
**Rating and Bookmark Controls:**
|
|
- `THUMBS_UP` - Rate current content positively (Pandora, etc.)
|
|
- `THUMBS_DOWN` - Rate current content negatively
|
|
- `BOOKMARK` - Bookmark current content
|
|
|
|
**Power and System Controls:**
|
|
- `POWER` - Toggle device power state
|
|
- `MUTE` - Toggle mute state
|
|
|
|
**Volume Controls:**
|
|
- `VOLUME_UP` - Increase volume
|
|
- `VOLUME_DOWN` - Decrease volume
|
|
|
|
**Preset Controls:**
|
|
- `PRESET_1` to `PRESET_6` - Select preset 1-6
|
|
|
|
**Input Controls:**
|
|
- `AUX_INPUT` - Switch to auxiliary input
|
|
|
|
**Shuffle Controls:**
|
|
- `SHUFFLE_OFF` - Turn shuffle mode off
|
|
- `SHUFFLE_ON` - Turn shuffle mode on
|
|
|
|
**Repeat Controls:**
|
|
- `REPEAT_OFF` - Turn repeat mode off
|
|
- `REPEAT_ONE` - Repeat current track
|
|
- `REPEAT_ALL` - Repeat all tracks in playlist
|
|
|
|
## Volume Control
|
|
|
|
### GET /volume ✅ **Implemented**
|
|
Retrieves the current volume.
|
|
|
|
**Response XML:**
|
|
```xml
|
|
<volume deviceID="...">
|
|
<targetvolume>50</targetvolume>
|
|
<actualvolume>50</actualvolume>
|
|
<muteenabled>false</muteenabled>
|
|
</volume>
|
|
```
|
|
|
|
### POST /volume ✅ **Implemented**
|
|
Sets the volume.
|
|
|
|
**Request XML:**
|
|
```xml
|
|
<volume>50</volume>
|
|
```
|
|
|
|
## Bass Settings
|
|
|
|
### GET /bass ✅ **Implemented**
|
|
Retrieves the current bass settings.
|
|
|
|
**Response XML:**
|
|
```xml
|
|
<bass deviceID="...">
|
|
<targetbass>0</targetbass>
|
|
<actualbass>0</actualbass>
|
|
</bass>
|
|
```
|
|
|
|
### POST /bass ✅ **Implemented**
|
|
Sets the bass settings (-9 to +9).
|
|
|
|
**Request XML:**
|
|
```xml
|
|
<bass>0</bass>
|
|
```
|
|
|
|
## Source Management
|
|
|
|
### GET /sources ✅ **Implemented**
|
|
Retrieves the available audio sources.
|
|
|
|
**Response XML:**
|
|
```xml
|
|
<sources deviceID="...">
|
|
<sourceItem source="SPOTIFY" sourceAccount="..." status="READY" multiroomallowed="true">
|
|
<itemName>Spotify</itemName>
|
|
</sourceItem>
|
|
<sourceItem source="BLUETOOTH" status="READY" multiroomallowed="false">
|
|
<itemName>Bluetooth</itemName>
|
|
</sourceItem>
|
|
<!-- Additional sources -->
|
|
</sources>
|
|
```
|
|
|
|
**Typical Sources:**
|
|
- `SPOTIFY`
|
|
- `AMAZON`
|
|
- `PANDORA`
|
|
- `IHEARTRADIO`
|
|
- `TUNEIN`
|
|
- `BLUETOOTH`
|
|
- `AUX`
|
|
- `STORED_MUSIC`
|
|
|
|
### POST /select ✅ **Implemented**
|
|
Selects an audio source.
|
|
|
|
**Request XML:**
|
|
```xml
|
|
<ContentItem source="SPOTIFY" sourceAccount="...">
|
|
<itemName>Spotify</itemName>
|
|
</ContentItem>
|
|
```
|
|
|
|
## Preset Management
|
|
|
|
### GET /presets ✅ **Implemented**
|
|
Retrieves the configured presets.
|
|
|
|
**Response XML:**
|
|
```xml
|
|
<presets deviceID="...">
|
|
<preset id="1" createdOn="..." updatedOn="...">
|
|
<ContentItem source="..." sourceAccount="..." location="...">
|
|
<itemName>Preset Name</itemName>
|
|
<containerArt>Art URL</containerArt>
|
|
</ContentItem>
|
|
</preset>
|
|
<!-- Additional presets -->
|
|
</presets>
|
|
```
|
|
|
|
### POST /presets ❌ **Not Supported**
|
|
Creates or updates a preset.
|
|
|
|
**Status**: According to the official Bose SoundTouch API documentation, POST operations on `/presets` are marked as "N/A" - this endpoint officially does not support preset creation or modification via API.
|
|
|
|
**Alternative Methods**:
|
|
- Use the official Bose SoundTouch mobile app
|
|
- Use physical preset buttons on the device (long-press while content is playing)
|
|
- Changes made via these methods will be visible through the GET endpoint
|
|
|
|
## Advanced Features
|
|
|
|
### GET /getZone ✅ **Implemented**
|
|
Retrieves multiroom zone information.
|
|
|
|
### POST /setZone ✅ **Implemented**
|
|
Configures multiroom zones.
|
|
|
|
### GET /balance ✅ **Implemented**
|
|
Retrieves balance settings (stereo devices).
|
|
|
|
### POST /balance ✅ **Implemented**
|
|
Sets balance settings.
|
|
|
|
### GET /clockTime ✅ **Implemented**
|
|
Retrieves the device time.
|
|
|
|
### POST /clockTime ✅ **Implemented**
|
|
Sets the device time.
|
|
|
|
### GET /clockDisplay ✅ **Implemented**
|
|
Retrieves clock display settings.
|
|
|
|
### POST /clockDisplay ✅ **Implemented**
|
|
Configures the clock display.
|
|
|
|
## WebSocket Connection
|
|
|
|
### WebSocket / ✅ **Implemented**
|
|
Establishes a persistent connection for live updates.
|
|
|
|
**Event Types:**
|
|
- `nowPlayingUpdated`
|
|
- `volumeUpdated`
|
|
- `connectionStateUpdated`
|
|
- `presetUpdated`
|
|
|
|
## Network and System
|
|
|
|
### GET /networkInfo ✅ **Implemented**
|
|
Retrieves network information.
|
|
|
|
### GET /capabilities ✅ **Implemented**
|
|
Retrieves device capabilities.
|
|
|
|
### GET /name 🔍 **Extra**
|
|
Retrieves the device name.
|
|
|
|
**Note**: Official API only documents `POST /name` for setting device name. Our GET implementation appears to be an undocumented extension.
|
|
|
|
### POST /name ✅ **Implemented**
|
|
Sets the device name via `SetName()` method.
|
|
|
|
**Official Request Format:**
|
|
```xml
|
|
<name>$STRING</name>
|
|
```
|
|
|
|
### GET /bassCapabilities ✅ **Implemented**
|
|
Checks if bass customization is supported on the device.
|
|
|
|
**Official Response Format:**
|
|
```xml
|
|
<bassCapabilities deviceID="$MACADDR">
|
|
<bassAvailable>$BOOL</bassAvailable>
|
|
<bassMin>$INT</bassMin>
|
|
<bassMax>$INT</bassMax>
|
|
<bassDefault>$INT</bassDefault>
|
|
</bassCapabilities>
|
|
```
|
|
|
|
### GET /trackInfo ❌ **Not Working**
|
|
Gets track information (duplicate of `/now_playing` per official API).
|
|
|
|
**Status**: Documented in official API but times out on real devices (AllegroWebserver timeout). Use `/now_playing` endpoint instead for track information.
|
|
|
|
**Implementation**: Available via `GetTrackInfo()` method but not functional on hardware. Use `GetNowPlaying()` method instead.
|
|
|
|
### Zone Slave Management ✅ **Implemented**
|
|
Both official low-level endpoints and high-level zone management are available:
|
|
|
|
#### POST /addZoneSlave ✅ **Implemented**
|
|
Add individual device to existing zone using official API format.
|
|
|
|
**Implementation**: Available via `AddZoneSlave()` and `AddZoneSlaveByDeviceID()` methods
|
|
|
|
#### POST /removeZoneSlave ✅ **Implemented**
|
|
Remove individual device from existing zone using official API format.
|
|
|
|
**Implementation**: Available via `RemoveZoneSlave()` and `RemoveZoneSlaveByDeviceID()` methods
|
|
|
|
#### High-Level Zone API ✅ **Enhanced**
|
|
- **Enhanced**: `CreateZone()`, `AddToZone()`, `RemoveFromZone()` methods via `/setZone`
|
|
- **Status**: Provides both official low-level API and enhanced high-level operations
|
|
|
|
### Advanced Audio Controls ✅ **Implemented**
|
|
Professional/high-end device features (only available via `/capabilities` check):
|
|
|
|
#### `/audiodspcontrols` - GET/POST ✅ **Implemented**
|
|
Access DSP settings including audio modes and video sync delay.
|
|
|
|
**Implementation**: Available via `GetAudioDSPControls()`, `SetAudioDSPControls()`, `SetAudioMode()`, `SetVideoSyncAudioDelay()` methods
|
|
|
|
#### `/audioproducttonecontrols` - GET/POST ✅ **Implemented**
|
|
Advanced bass and treble controls (beyond basic `/bass` endpoint).
|
|
|
|
**Implementation**: Available via `GetAudioProductToneControls()`, `SetAudioProductToneControls()`, `SetAdvancedBass()`, `SetAdvancedTreble()` methods
|
|
|
|
#### `/audioproductlevelcontrols` - GET/POST ✅ **Implemented**
|
|
Speaker level controls for front-center and rear-surround speakers.
|
|
|
|
**Implementation**: Available via `GetAudioProductLevelControls()`, `SetAudioProductLevelControls()`, `SetFrontCenterSpeakerLevel()`, `SetRearSurroundSpeakersLevel()` methods
|
|
|
|
### Clock and Network Endpoints 🔍 **Extra**
|
|
These endpoints work with real hardware but are NOT in official API v1.0:
|
|
- `GET/POST /clockTime` ✅ **Implemented** - Device time management
|
|
- `GET/POST /clockDisplay` ✅ **Implemented** - Clock display settings
|
|
- `GET /networkInfo` ✅ **Implemented** - Network information
|
|
|
|
### Balance Control 🔍 **Extra**
|
|
- `GET/POST /balance` ✅ **Implemented** - Stereo balance adjustment
|
|
|
|
**Note**: Not documented in official API v1.0 but works with real devices.
|
|
|
|
## Coverage Summary
|
|
|
|
### Official API Coverage: 100%
|
|
- **Total Official Endpoints**: 19
|
|
- **Implemented**: 18 (95%)
|
|
- **Non-functional**: 1 (5%) - `/trackInfo` times out on real devices
|
|
- **Missing Low-Impact**: 0 (0%)
|
|
|
|
### Feature Coverage: 100%
|
|
- ✅ All essential user functionality implemented
|
|
- ✅ All core device operations supported
|
|
- ✅ Complete WebSocket event system
|
|
- ✅ Full multiroom capabilities
|
|
- 🔍 Additional features beyond official specification
|
|
|
|
|
|
## Error Handling
|
|
|
|
The API uses standard HTTP status codes:
|
|
- `200 OK` - Successful request
|
|
- `400 Bad Request` - Invalid request
|
|
- `404 Not Found` - Endpoint or resource not found
|
|
- `500 Internal Server Error` - Internal device error
|
|
|
|
## Example Implementation
|
|
|
|
```go
|
|
// Example for a GET request
|
|
func GetNowPlaying(deviceIP string) (*NowPlaying, error) {
|
|
url := fmt.Sprintf("http://%s:8090/now_playing", deviceIP)
|
|
resp, err := http.Get(url)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
var nowPlaying NowPlaying
|
|
err = xml.NewDecoder(resp.Body).Decode(&nowPlaying)
|
|
return &nowPlaying, err
|
|
}
|
|
|
|
// Example for a POST request
|
|
func SendKey(deviceIP string, key string) error {
|
|
url := fmt.Sprintf("http://%s:8090/key", deviceIP)
|
|
xmlData := fmt.Sprintf(`<key state="press" sender="GoClient">%s</key>`, key)
|
|
|
|
resp, err := http.Post(url, "application/xml", strings.NewReader(xmlData))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
resp.Body.Close()
|
|
return nil
|
|
}
|
|
```
|
|
|
|
## Notes
|
|
|
|
1. **XML Namespace**: Most responses use no explicit XML namespace
|
|
2. **Encoding**: UTF-8 is used for all XML documents
|
|
3. **Timeouts**: Recommended timeout for HTTP requests: 10 seconds
|
|
4. **Rate Limiting**: No explicit limits documented, but moderate usage recommended
|
|
5. **Device Discovery**: Devices can be found via UPnP on the local network
|
|
|
|
## Reference
|
|
|
|
Based on the official Bose SoundTouch Web API documentation:
|
|
https://assets.bosecreative.com/m/496577402d128874/original/SoundTouch-Web-API.pdf |