Use the modifyGroupMembers
command in the groups
namespace to add players to and remove players from a group. In response to this command, Sonos first adds players to the group, then removes players from the group.
Endpoint
POST
1 |
/groups/{groupId}/groups/modifyGroupMembers |
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 |
---|---|---|
playerIdsToAdd |
array | An array of player ID strings of players to add to the group. |
playerIdsToRemove |
array | An array of player ID strings of players to remove from the group. |
Response
Returns a groupInfo
object, which currently only includes a group
object. The groupInfo
object may include additional information in the future.
In the event of a failure, returns a globalError
.
Example
Request
In the example below, the original group is PID0, PID1, and PID2.
1 2 3 4 5 6 7 8 |
{ "playerIdsToAdd" : [ "PID3", "PID4" ], "playerIdsToRemove" : [ "PID0", "PID1" ] } |
Response
1 2 3 4 5 6 7 8 |
{ "group": { "playerIds": ["PID2","PID3", "PID4"], "coordinatorId": "PID2", "id": "XYZ-123abc456:12", "name": "player2 + 2" } } |