# Generic SCIM Endpoint - Replace Group

The Replace Group endpoint replaces the requested role in its entirety.

### Request

#### Endpoint

`/provisioning/generic/v2/Groups/<ID>`

#### HTTP method

`PUT`

#### Path variables

| Variable | Requirement | Description | Notes                                     | Example   |
| -------- | ----------- | ----------- | ----------------------------------------- | --------- |
| `<ID>`   | Required    | Role ID     | Returns a 404 if the role ID is not found | `r-00001` |

#### Request body attributes

| Attribute     | Requirement | Description                                                                                                                                                                                          | Notes                                                                                                      | Example                                                                  |
| ------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| `displayName` | Required    | Display name of the role                                                                                                                                                                             | Returns a 400 if the provided value is empty; returns a 409 if the provided value is already in use        | `"RoleName"`                                                             |
| `members`     | Required    | List of the members of the role with subattributes `value` (user ID) and `display` (human-readable descriptor of the user, for your own use) of the user(s) to be assigned to the role from creation | Returns a 400 if the IDs are formatted incorrectly or are invalid; returns a 404 if user IDs are not found | `[{"value": "a-66f584886171b51d", "display": "userEmail@example.test"}]` |
| `schemas`     | Required    | Schema URI for representing groups                                                                                                                                                                   | Include the value as indicated in the example.                                                             | `["urn:ietf:params:scim:schemas:core:2.0:Group"]`                        |

#### Example request

`PUT app.strongdm.com/provisioning/generic/v2/Groups/r-00001`

```json
{
  "schemas": ["urn:ietf:params:scim:schemas:core:2.0:Group"],
  "displayName": "TestPutBasic",
  "members": []
}
```

### Response

#### Example success response

```http
(Status 204)
```

```json
{
  "schemas": ["urn:ietf:params:scim:schemas:core:2.0:Group"],
  "displayName": "NewRoleName",
  "id": "r-00001",
  "members": [],
  "meta": { "resourceType": "Group", "location": "Groups/r-00001" }
}
```

#### Example response if role ID is not found

```json
{
  "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"],
  "detail": "Resource r-1230954 not found.",
  "status": "404"
}
```

#### Example response if new role name is empty

```json
{
  "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"],
  "detail": "could not update role name: cannot update role: invalid operation: name cannot be empty",
  "status": "400"
}
```

#### Example response if user ID is malformed

```json
{
  "schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"],
  "detail": "cannot parse member id: aa-123134",
  "status": "400"
}
```
