Finding Users
Problem
You want to find users.
Solution
Use the users.find method to find users.
from posit import connect
client = connect.Client()
users = client.users.find()>>> pl.DataFrame(users)
shape: (1, 11)
┌─────────────────────────────────┬──────────┬─────────────────┬────────────┬───┬──────────────────────┬──────────────────────┬───────────┬────────┐
│ guid ┆ username ┆ email ┆ first_name ┆ … ┆ updated_time ┆ active_time ┆ confirmed ┆ locked │
│ --- ┆ --- ┆ --- ┆ --- ┆ ┆ --- ┆ --- ┆ --- ┆ --- │
│ str ┆ str ┆ str ┆ str ┆ ┆ str ┆ str ┆ bool ┆ bool │
╞═════════════════════════════════╪══════════╪═════════════════╪════════════╪═══╪══════════════════════╪══════════════════════╪═══════════╪════════╡
│ c6440668-15d0-4343-b3c8-18755c… ┆ admin ┆ admin@posit.co ┆ John ┆ … ┆ 2018-07-10T21:26:57Z ┆ 2018-07-17T15:18:26Z ┆ true ┆ false │
│ afeb15e7-274f-4981-a6d3-677cc3… ┆ hadley ┆ hadley@posit.co ┆ Hadley ┆ … ┆ 2024-06-18T13:25:27Z ┆ 2024-06-18T13:25:27Z ┆ true ┆ false │
└─────────────────────────────────┴──────────┴─────────────────┴────────────┴───┴──────────────────────┴──────────────────────┴───────────┴────────┘library(connectapi)
client <- connect()
users <- get_users(client)> users
users[1,]
# A tibble: 2 × 11
email username first_name last_name user_role created_time
<chr> <chr> <chr> <chr> <chr> <dttm>
1 admin@rstudio.com admin John Admin admin 2018-07-10 04:52:04
2 hadley@posit.co hadley Hadley Wickham publisher 2015-05-20 19:44:37
# ℹ 5 more variables: updated_time <dttm>, active_time <dttm>, confirmed <lgl>,
# lockedDiscussion
These methods provide an effective way to search for users when you do not know their unique identifier (GUID).
There are additional parameters that you can use to filter the resulting users set.
You can use the prefix parameter to find users by username, first name, or last name.
PREFIX = "h"
client.users.find(prefix=PREFIX)PREFIX = 'h'
get_users(client, prefix = PREFIX)