# Set Group

```
PATCH /setgroupmembership
```

## Parameters

| Parameter    | Data Type         | Value                              |
| ------------ | ----------------- | ---------------------------------- |
| `serial`     | string, required  | the serial number of a vssl device |
| `parentZone` | integer, required | the parent zone number             |
| `childZone`  | integer, required | the child zone number              |

## Response

Status of the call

## Note

You can only create a group from a zone that is currently playing.

```
AddZoneToGroup: If z1 is currently playing then you can create a new group by adding z2 by ~SetGroup(vsslSerial, 1, 2).  Z1 and z2
will now be playing the z1 stream.  If the z1 stream is stopped then the group will automatically dissolve.  If a stream is
started on z2 while z2 is in the group then the z2 content will not output on the z2 speaker until z2 is removed from the group.

RemoveZoneFromGroup: If a group exists with z1 as the parent and (z2, z3) as children then you can remove z2 from the group by
setting its parent to 255 ~SetGroup(vsslSerial, 255, 2).

DissolveGroup: If a group exists with z1 as the parent and (z2, z3) as children then you can remove z2 from the group by
setting the child group to 255 ~SetGroup(vsslSerial, 1, 255).
```

## Example Request

Sample HTTP request

{% tabs %}
{% tab title="curl" %}

```bash
$ curl --request PATCH http://192.168.0.15:8000/api/setgroup?'serial=00BD27EF657D&parentZone=1&childZone=2'
```

{% endtab %}

{% tab title="IP Cmd" %}

```bash
IP: 192.168.0.15
Host: 8000
Data: "PATCH /api/setgroup?serial=00BD27EF657D&parentZone=1&childZone=2 HTTP/1.1\r\n\r\n"
```

{% endtab %}

{% tab title="httpie" %}

```bash
$ http PATCH 192.168.0.15:8000/api/setgroup serial=00BD27EF657D parentZone=1 childZone=2
```

{% endtab %}

{% tab title="node" %}

```javascript
const axios = require('axios');

axios.patch('http://192.168.0.15:8000/api/setgroup
', {
    params: {
      serial: '00BD27EF657D',
      parentZone: 1,
      childZone: 2
    }
  }).then((response)=>{
    console.log(response);
  }).catch((response)=>{
    console.log('Error making request');
  })
```

{% endtab %}
{% endtabs %}

## Example Response

```javascript
{
  "status": "request sent"
}
```
