Skip to content

docs: bulk add/remove group users #1441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions docs/api-ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,56 @@ None.
<br>
<br>

#### groups.add_users

```py
groups.add_users(group_item, user_id):
```

Adds multiple users to the specified group.


REST API [Add User to Group](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref.htm#add_user_to_group)

**Version**

This endpoint is available with REST API version 3.21 and up. Method added in
version v0.33

**Parameters**

Name | Description
:--- | :---
`group_item` | The `group_item` specifies the group to update.
`users` | An Iterable of UserItems, or user ids.




**Returns**

list[UserItem]


**Example**

```py
# Adding a user to a group
#
# get the group item
all_groups, pagination_item = server.groups.get()
mygroup = all_groups[1]

# Add Viewers to the group
added_users = server.groups.add_users(
mygroup,
server.users.filter(site_role=TSC.UserItem.Roles.Viewer)
)
```

<br>
<br>

#### groups.create

```py
Expand Down Expand Up @@ -1244,6 +1294,56 @@ None. The user is removed from the group.
<br>
<br>

#### groups.remove_users

```py
groups.remove_users(group_item, user_id):
```

Removes multiple users from the specified group.


REST API [Remove User from Group](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref.htm#remove_user_to_group)

**Version**

This endpoint is available with REST API version 3.21 and up. Method added in
version v0.33

**Parameters**

Name | Description
:--- | :---
`group_item` | The `group_item` specifies the group to update.
`users` | An Iterable of UserItems, or user ids.




**Returns**

None


**Example**

```py
# Removing a user from a group
#
# get the group item
all_groups, pagination_item = server.groups.get()
mygroup = all_groups[1]

# Remove Viewers from the group
server.groups.remove_users(
mygroup,
server.users.filter(site_role=TSC.UserItem.Roles.Viewer)
)
```

<br>
<br>


#### groups.update

Expand Down