Skip to contents

Creates a connection to Posit Connect using the server URL and an api key. Validates the connection and checks that the version of the server is compatible with the current version of the package.

Usage

connect(
  server = Sys.getenv(paste0(prefix, "_SERVER"), NA_character_),
  api_key = Sys.getenv(paste0(prefix, "_API_KEY"), NA_character_),
  prefix = "CONNECT",
  ...,
  .check_is_fatal = TRUE
)

Arguments

server

The URL for accessing Posit Connect. Defaults to environment variable CONNECT_SERVER

api_key

The API Key to authenticate to Posit Connect with. Defaults to environment variable CONNECT_API_KEY

prefix

The prefix used to determine environment variables

...

Additional arguments. Not used at present

.check_is_fatal

Whether to fail if "check" requests fail. Useful in rare cases where more http request customization is needed for requests to succeed.

Value

A Posit Connect R6 object that can be passed along to methods

Examples

if (FALSE) { # \dontrun{
connect()
} # }


# default is to read CONNECT_SERVER and CONNECT_API_KEY environment variables
# this example will read TEST_1_SERVER and TEST_1_API_KEY
connect(prefix = "TEST_1")
#> Defining Connect with server: http://localhost:32768
#> Posit Connect API Client: 
#>   Posit Connect Server: http://localhost:32768
#>   Posit Connect API Key: ***********5Ltl
#>