| PositConnect {connectapi} | R Documentation |
Class representing a Connect API client
Description
Class representing a Connect API client
Class representing a Connect API client
Usage
client <- Connect$new(server = 'connect.example.com', apiKey = 'mysecretkey') client$get_apps() client$get_tags()
Details
This class allows a user to interact with a Connect server via the Connect API. Authentication is done by providing an API key.
Public fields
serverThe base URL of your Posit Connect server.
api_keyYour Posit Connect API key.
tagsThe initial set of tags.
tag_mapThe initial tag map.
httr_additionsAn initial set of
httrconfiguration added to each HTTP call.using_authIndicates that the API key is added to each HTTP call.
Methods
Public methods
Method get_connect()
Return this connect.
Usage
Connect$get_connect()
Method new()
Initialize a new connect.
Usage
Connect$new(server, api_key)
Arguments
serverThe base URL of your Posit Connect server.
api_keyYour Posit Connect API key.
Method httr_config()
Set additional httr configuration that is added to each HTTP call.
Usage
Connect$httr_config(...)
Arguments
...Set of httr configurations.
Method print()
Print details about this instance.
Usage
Connect$print(...)
Arguments
...Ignored.
Method raise_error()
Raise an error when the HTTP result is an HTTP error.
Usage
Connect$raise_error(res)
Arguments
resHTTP result.
Method add_auth()
Returns HTTP authorization headers, or NULL when none are used.
Usage
Connect$add_auth()
Method GET()
Perform an HTTP GET request of the named API path. Returns an object parsed from the HTTP response.
Usage
Connect$GET(path, writer = httr::write_memory(), parser = "parsed", ...)
Arguments
pathAPI path.
writerControls where the response is written.
parserHow the response is parsed.
...Arguments to the httr::GET.
Method GET_RESULT()
Perform an HTTP GET request of the named API path. Returns the HTTP response object.
Usage
Connect$GET_RESULT(path, writer = httr::write_memory(), ...)
Arguments
pathAPI path.
writerControls where the response is written.
...Arguments to the httr::GET.
Method GET_URL()
Perform an HTTP GET request of the named URL. Returns an object parsed from the HTTP response.
Usage
Connect$GET_URL(url, writer = httr::write_memory(), parser = "parsed", ...)
Arguments
urlTarget URL.
writerControls where the response is written.
parserHow the response is parsed.
...Arguments to the httr::GET.
Method GET_RESULT_URL()
Perform an HTTP GET request of the named URL. Returns the HTTP response object.
Usage
Connect$GET_RESULT_URL(url, writer = httr::write_memory(), ...)
Arguments
urlTarget URL.
writerControls where the response is written.
...Arguments to the httr::GET.
Method PUT()
Perform an HTTP PUT request of the named API path. Returns an object parsed from the HTTP response.
Usage
Connect$PUT(path, body, encode = "json", ..., .empty_object = TRUE)
Arguments
pathAPI path.
bodyThe HTTP payload.
encodeHow the payload is encoded.
...Arguments to the httr::PUT.
.empty_objectIndicates that an empty JSON object is sent when the body is empty.
Method HEAD()
Perform an HTTP HEAD request of the named API path. Returns the HTTP response object.
Usage
Connect$HEAD(path, ...)
Arguments
pathAPI path.
...Arguments to the httr::HEAD.
Method DELETE()
Perform an HTTP DELETE request of the named API path. Returns the HTTP response object.
Usage
Connect$DELETE(path, ...)
Arguments
pathAPI path.
...Arguments to the httr::DELETE.
Method PATCH()
Perform an HTTP PATCH request of the named API path. Returns an object parsed from the HTTP response.
Usage
Connect$PATCH( path, body, encode = "json", prefix = "/__api__/", ..., .empty_object = TRUE )
Arguments
pathAPI path.
bodyThe HTTP payload.
encodeHow the payload is encoded.
prefixAPI path prefix.
...Arguments to the httr::PATCH.
.empty_objectIndicates that an empty JSON object is sent when the body is empty.
Method POST()
Perform an HTTP POST request of the named API path. Returns an object parsed from the HTTP response.
Usage
Connect$POST( path, body, encode = "json", prefix = "/__api__/", ..., .empty_object = TRUE )
Arguments
pathAPI path.
bodyThe HTTP payload.
encodeHow the payload is encoded.
prefixAPI path prefix.
...Arguments to the httr::POST.
.empty_objectIndicates that an empty JSON object is sent when the body is empty.
Method me()
Perform an HTTP GET request of the "me" server endpoint.
Usage
Connect$me()
Method get_dashboard_url()
Return the base URL of the Connect server.
Usage
Connect$get_dashboard_url()
Method get_tags()
Return all tags.
Usage
Connect$get_tags(use_cache = FALSE)
Arguments
use_cacheIndicates that a cached set of tags is used.
Method get_tag_id()
Get the identifier for the named tag.
Usage
Connect$get_tag_id(tagname)
Arguments
tagnameThe name of the tag.
Method get_tag_tree()
Get the tag tree.
Usage
Connect$get_tag_tree()
Method tag_create_safe()
Create a tag.
Usage
Connect$tag_create_safe(name, parent_id = NULL)
Arguments
nameThe tag name.
parent_idThe parent identifier.
Method tag_create()
Create a tag.
Usage
Connect$tag_create(name, parent_id = NULL)
Arguments
nameThe tag name.
parent_idThe parent identifier.
Method tag()
Get a tag.
Usage
Connect$tag(id = NULL)
Arguments
idThe tag identifier.
Method tag_delete()
Delete a tag.
Usage
Connect$tag_delete(id)
Arguments
idThe tag identifier.
Method get_apps()
Get content items.
Usage
Connect$get_apps(filter = NULL, .collapse = "&", .limit = Inf, page_size = 25)
Arguments
filterNamed list containing filter conditions.
.collapseHow multiple filters are combined.
.limitThe limit.
page_sizeThe page size.
Method get_schedule()
Get a schedule.
Usage
Connect$get_schedule(schedule_id)
Arguments
schedule_idThe schedule identifier.
Method content_create()
Create content.
Usage
Connect$content_create(name, title = name, ...)
Arguments
nameThe content name.
titleThe content title.
...Other content fields.
Method content_upload()
Upload a content bundle.
Usage
Connect$content_upload(bundle_path, guid)
Arguments
bundle_pathThe path to the bundle archive.
guidThe content GUID.
Method content_deploy()
Deploy a content bundle.
Usage
Connect$content_deploy(guid, bundle_id)
Arguments
guidThe content GUID.
bundle_idThe bundle identifier.
Method content()
Get a content item.
Usage
Connect$content( guid = NULL, owner_guid = NULL, name = NULL, include = "tags,owner" )
Arguments
guidThe content GUID.
owner_guidThe target content owner.
nameThe target name.
includeAdditional response fields.
Method task()
Get a task.
Usage
Connect$task(task_id, first = 0, wait = 5)
Arguments
task_idThe task identifier.
firstThe initial status position.
waitMaximum time to wait for update.
Method set_content_tag()
Set a tag for a content item.
Usage
Connect$set_content_tag(content_id, tag_id)
Arguments
content_idThe content identifier.
tag_idThe tag identifier.
Method remove_content_tag()
Remove a tag from a content item.
Usage
Connect$remove_content_tag(content_id, tag_id)
Arguments
content_idThe content identifier.
tag_idThe tag identifier.
Method user()
Get user details.
Usage
Connect$user(guid)
Arguments
guidThe user GUID.
Method users()
Get users.
Usage
Connect$users(page_number = 1, prefix = NULL, page_size = 500)
Arguments
page_numberThe page number.
prefixThe search term.
page_sizeThe page size.
Method users_remote()
Get remote users.
Usage
Connect$users_remote(prefix)
Arguments
prefixThe search term.
Method users_create()
Create a user.
Usage
Connect$users_create( username, email, first_name = NULL, last_name = NULL, password = NULL, user_must_set_password = NULL, user_role = NULL, unique_id = NULL )
Arguments
usernameThe username.
emailEmail address.
first_nameFirst name.
last_nameLast name.
passwordThe password.
user_must_set_passwordIndicates that user sets password on first login.
user_roleRole for user.
unique_idIdentifier for user.
Method users_create_remote()
Create a remote user.
Usage
Connect$users_create_remote(temp_ticket)
Arguments
temp_ticketTicket identifying target remote user.
Method users_lock()
Lock a user.
Usage
Connect$users_lock(user_guid)
Arguments
user_guidUser GUID.
Method users_unlock()
Unlock a user.
Usage
Connect$users_unlock(user_guid)
Arguments
user_guidUser GUID.
Method users_update()
Update a user.
Usage
Connect$users_update(user_guid, ...)
Arguments
user_guidUser GUID.
...User fields.
Method groups()
Get groups.
Usage
Connect$groups(page_number = 1, prefix = NULL, page_size = 500)
Arguments
page_numberThe page number.
prefixThe search term.
page_sizeThe page size.
Method group_members()
Get group members.
Usage
Connect$group_members(guid)
Arguments
guidThe group GUID.
Method group_member_add()
Add a group member.
Usage
Connect$group_member_add(group_guid, user_guid)
Arguments
group_guidThe group GUID.
user_guidThe user GUID.
Method group_member_remove()
Remove a group member.
Usage
Connect$group_member_remove(group_guid, user_guid)
Arguments
group_guidThe group GUID.
user_guidThe user GUID.
Method groups_create()
Create a group.
Usage
Connect$groups_create(name)
Arguments
nameThe group name.
Method groups_create_remote()
Create a remote group.
Usage
Connect$groups_create_remote(temp_ticket)
Arguments
temp_ticketTicket identifying target remote group.
Method groups_remote()
Get remote groups.
Usage
Connect$groups_remote(prefix = NULL, limit = 500)
Arguments
prefixThe search term.
limitThe maximal result set size.
Method inst_content_visits()
Get (non-interactive) content visits.
Usage
Connect$inst_content_visits( content_guid = NULL, min_data_version = NULL, from = NULL, to = NULL, limit = 500, previous = NULL, nxt = NULL, asc_order = TRUE )
Arguments
content_guidContent GUID.
min_data_versionData version for request.
fromStart of range.
toEnd of range.
limitResult set size.
previousPrevious item.
nxtNext item.
asc_orderIndicates ascending result order.
Method inst_shiny_usage()
Get interactive content visits.
Get (non-interactive) content visits.
Usage
Connect$inst_shiny_usage( content_guid = NULL, min_data_version = NULL, from = NULL, to = NULL, limit = 500, previous = NULL, nxt = NULL, asc_order = TRUE )
Arguments
content_guidContent GUID.
min_data_versionData version for request.
fromStart of range.
toEnd of range.
limitResult set size.
previousPrevious item.
nxtNext item.
asc_orderIndicates ascending result order.
Method procs()
Get running processes.
Usage
Connect$procs()
Method repo_account()
Determine if Git repository is associated with authorization.
Usage
Connect$repo_account(host)
Arguments
hostRepository URL.
Method repo_branches()
Get Git repository branches.
Usage
Connect$repo_branches(repo)
Arguments
repoRepository URL.
Method repo_manifest_dirs()
Get Git repository directories.
Usage
Connect$repo_manifest_dirs(repo, branch)
Arguments
repoRepository URL.
branchRepository branch.
Method schedules()
Get schedules.
Usage
Connect$schedules( start = Sys.time(), end = Sys.time() + 60 * 60 * 24 * 7, detailed = FALSE )
Arguments
startStarting time.
endEnding time.
detailedIndicates detailed schedule information.
Method docs()
Get documentation.
Usage
Connect$docs(docs = "api", browse = TRUE)
Arguments
docsNamed document.
browseOpen a browser.
Method audit_logs()
Get auditing.
Usage
Connect$audit_logs(limit = 500, previous = NULL, nxt = NULL, asc_order = TRUE)
Arguments
limitResult set size.
previousPrevious item.
nxtNext item.
asc_orderIndicates ascending result order.
Method server_settings_r()
Get R installations.
Usage
Connect$server_settings_r()
Method server_settings()
Get server settings.
Usage
Connect$server_settings()
Method clone()
The objects of this class are cloneable with this method.
Usage
Connect$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
See Also
Other R6 classes:
Bundle,
Content,
ContentTask,
Environment,
Task,
Vanity,
Variant,
VariantSchedule,
VariantTask