Summary
The search method performs a free-text query against the directory for specific stations, shows, or show hosts.
Input
| Parameter | Description |
|---|---|
| id | The search domain, see below |
| term | The query text, at least 3 characters long |
| index | For paging, the index into the result set at which to start |
| count | The maximum number of results to return |
The search domains are:
- search:station – To find one or more stations
- search:show – To find one or more shows
- search:host – To find one or more shows by host name
Example request:
<?xml version="1.0" encoding="utf-16"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<credentials xmlns="http://www.sonos.com/Services/1.1">
<deviceId>0A:23:32:5B:9E:DC</deviceId>
<deviceProvider>YourProduct</deviceProvider>
</credentials>
</soap:Header>
<soap:Body>
<search xmlns="http://www.sonos.com/Services/1.1">
<id>search:station</id>
<term>kqed</term>
<index>0</index>
<count>10</count>
</search>
</soap:Body>
</soap:Envelope>
Output
For station results, the method will return a set of <mediaMetadata> elements. For show and host results, it will return <mediaCollection> elements.
<?xml version="1.0" encoding="utf-16"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<searchResponse xmlns="http://www.sonos.com/Services/1.1">
<searchResult>
<index>0</index>
<count>1</count>
<total>1</total>
<mediaMetadata>
<id>s34804</id>
<title>KQED-FM (San Francisco, CA)</title>
<itemType>stream</itemType>
<streamMetadata>
<currentShowId>p16</currentShowId>
<currentShow>Talk of the Nation</currentShow>
<currentHost>Neal Conan</currentHost>
<bitrate>0</bitrate>
<logo>http://radiotime-logos.s3.amazonaws.com/s34804q.gif</logo>
<title>88.5 FM</title>
<subtitle>San Francisco, United States</subtitle>
<secondsRemaining>0</secondsRemaining>
<secondsToNextShow>0</secondsToNextShow>
</streamMetadata>
</mediaMetadata>
</searchResult>
</searchResponse>
</soap:Body>
</soap:Envelope>
The response mediaMetadata is similar to the mediaMetadata returned in the getMetadata call on a container with items.
Notes
The service will find partial matches of the keyword text for stations, otherwise it will look for exact hits.