The loadFavorite
command in the favorites
namespace activates a favorite within the default playback session. This command interrupts any active private playback sessions. Sonos adds album, tracklist, and track favorites to the queue and activates the queue. This prevents your app from overwriting user-curated queues.
Endpoint
POST
1 |
/groups/{groupId}/favorites |
Request parameters
This command requires a groupId
to determine the target of the command. See the Control documentation for details.
See the table below for descriptions of parameters in the body.
Parameter | Type | Value |
---|---|---|
action |
queueAction | (Optional) Controls how the the player inserts the favorite into the shared queue, such as append, insert, insert next, or replace. Not used when the favorite is a radio station (programmed or streamed). If omitted, defaults to append. |
favoriteId |
string | The identifier of the favorite. You can find this in the favoriteList object in the getFavorites response. |
playOnCompletion |
boolean | (Optional) If true, the player automatically starts playback. If false or not provided, the player remains in the PLAYBACK_IDLE state. |
playModes |
playModes | (Optional) Defines the functionality of one or more play modes. You can set these to customize shuffle, repeat, repeat-one and crossfade. The player ignores this parameter when the loaded favorite does not allow custom play modes, such as for streaming radio stations. |
Response
Returns an empty body with a success
value of true if successful.
In the event of a failure, returns a globalError
.
Example
Request
1 2 3 4 5 6 7 |
{ "favoriteId" : "3", "playOnCompletion" : true, "playModes" : { "shuffle" : true } } |
Response
1 2 3 4 5 6 7 8 |
{ "namespace": "favorites", "response": "loadFavorite", "success": true, "type": "none", "householdId": "HHID_4231", "groupId": "XYZ-123abc456:12" } |