rstudio / connectapi

An R package for interacting with the RStudio Connect Server API
https://pkgs.rstudio.com/connectapi/
Other
42 stars 25 forks source link

add optional filters to get_* functions #133

Open kmasiello opened 3 years ago

kmasiello commented 3 years ago

Many Connect API endpoints have optional filters for queries. Simplify connectapi queries by implementing these filters.

get_groups

non-existent get_instrumentation (aka get_shiny and get_content)

get_users

SamEdwardes commented 1 year ago

+1

I came across a use case today where I needed to get the details of a specific user (e.g. this endpoint: /v1/users/{guid}).

The only working solution I found was to call the API directly:

library(connectapi)
library(glue)
library(httr)

client <- connect()
user_guid <- user_guid_from_username(client, "sam.edwardes")
api_key <- Sys.getenv("CONNECT_API_KEY")
response <- GET(
    glue("{client$server}/__api__/v1/users/{user_guid}"),
    add_headers(Authorization = glue("Key {api_key}"))
)
user_data <- content(response)
user_data$email