PositConnect | R Documentation |
Class representing a Connect API client
Class representing a Connect API client
client <- Connect$new(server = 'connect.example.com', apiKey = 'mysecretkey') client$get_apps() client$get_tags()
This class allows a user to interact with a Connect server via the Connect API. Authentication is done by providing an API key.
server
The base URL of your Posit Connect server.
api_key
Your Posit Connect API key.
tags
The initial set of tags.
tag_map
The initial tag map.
httr_additions
An initial set of httr
configuration added to each HTTP call.
using_auth
Indicates that the API key is added to each HTTP call.
version
The server version.
get_connect()
Return this connect.
Connect$get_connect()
new()
Initialize a new connect.
Connect$new(server, api_key)
server
The base URL of your Posit Connect server.
api_key
Your Posit Connect API key.
httr_config()
Set additional httr
configuration that is added to each HTTP call.
Connect$httr_config(...)
...
Set of httr configurations.
print()
Print details about this instance.
Connect$print(...)
...
Ignored.
raise_error()
Raise an error when the HTTP result is an HTTP error.
Connect$raise_error(res)
res
HTTP result.
add_auth()
Returns HTTP authorization headers, or NULL when none are used.
Connect$add_auth()
api_url()
Build a URL relative to the API root
Connect$api_url(...)
...
path segments
server_url()
Build a URL relative to the server root
Connect$server_url(...)
...
path segments
request()
General wrapper around httr
verbs
Connect$request(method, url, ..., parser = "parsed")
method
HTTP request method
url
URL to request
...
Additional arguments passed to the request function
parser
How the response is parsed. If NULL
, the httr_response
will be returned. Otherwise, the argument is forwarded to
httr::content(res, as = parser)
.
GET()
Perform an HTTP GET request of the named API path.
Connect$GET(path, ..., url = self$api_url(path), parser = "parsed")
path
API path relative to the server's /__api__
root.
...
Arguments to httr::GET()
url
Target URL. Default uses path
, but provide url
to request
a server resource that is not under /__api__
parser
How the response is parsed. If NULL
, the httr_response
will be returned. Otherwise, the argument is forwarded to
httr::content(res, as = parser)
.
PUT()
Perform an HTTP PUT request of the named API path.
Connect$PUT( path, body = "{}", ..., url = self$api_url(path), encode = "json", parser = "parsed" )
path
API path relative to the server's /__api__
root.
body
The HTTP payload.
...
Arguments to httr::PUT()
url
Target URL. Default uses path
, but provide url
to request
a server resource that is not under /__api__
encode
How the payload is encoded.
parser
How the response is parsed. If NULL
, the httr_response
will be returned. Otherwise, the argument is forwarded to
httr::content(res, as = parser)
.
HEAD()
Perform an HTTP HEAD request of the named API path.
Connect$HEAD(path, ..., url = self$api_url(path))
path
API path relative to the server's /__api__
root.
...
Arguments to httr::HEAD()
url
Target URL. Default uses path
, but provide url
to request
a server resource that is not under /__api__
httr::content(res, as = parser)
.
DELETE()
Perform an HTTP DELETE request of the named API path. Returns the HTTP response object.
Connect$DELETE(path, ..., url = self$api_url(path), parser = NULL)
path
API path relative to the server's /__api__
root.
...
Arguments to httr::DELETE()
url
Target URL. Default uses path
, but provide url
to request
a server resource that is not under /__api__
parser
How the response is parsed. If NULL
, the httr_response
will be returned. Otherwise, the argument is forwarded to
httr::content(res, as = parser)
.
PATCH()
Perform an HTTP PATCH request of the named API path.
Connect$PATCH( path, body = "{}", ..., url = self$api_url(path), encode = "json", parser = "parsed" )
path
API path relative to the server's /__api__
root.
body
The HTTP payload.
...
Arguments to httr::PATCH()
url
Target URL. Default uses path
, but provide url
to request
a server resource that is not under /__api__
encode
How the payload is encoded.
parser
How the response is parsed. If NULL
, the httr_response
will be returned. Otherwise, the argument is forwarded to
httr::content(res, as = parser)
.
POST()
Perform an HTTP POST request of the named API path.
Connect$POST( path, body = "{}", ..., url = self$api_url(path), encode = "json", parser = "parsed" )
path
API path relative to the server's /__api__
root.
body
The HTTP payload.
...
Arguments to httr::POST()
url
Target URL. Default uses path
, but provide url
to request
a server resource that is not under /__api__
encode
How the payload is encoded.
parser
How the response is parsed. If NULL
, the httr_response
will be returned. Otherwise, the argument is forwarded to
httr::content(res, as = parser)
.
me()
Perform an HTTP GET request of the "me" server endpoint.
Connect$me()
get_dashboard_url()
Return the base URL of the Connect server.
Connect$get_dashboard_url()
get_tags()
Return all tags.
Connect$get_tags(use_cache = FALSE)
use_cache
Indicates that a cached set of tags is used.
get_tag_id()
Get the identifier for the named tag.
Connect$get_tag_id(tagname)
tagname
The name of the tag.
get_tag_tree()
Get the tag tree.
Connect$get_tag_tree()
tag_create_safe()
Create a tag.
Connect$tag_create_safe(name, parent_id = NULL)
name
The tag name.
parent_id
The parent identifier.
tag_create()
Create a tag.
Connect$tag_create(name, parent_id = NULL)
name
The tag name.
parent_id
The parent identifier.
tag()
Get a tag.
Connect$tag(id = NULL)
id
The tag identifier.
tag_delete()
Delete a tag.
Connect$tag_delete(id)
id
The tag identifier.
get_apps()
Get content items.
Connect$get_apps(filter = NULL, .collapse = "&", .limit = Inf, page_size = 25)
filter
Named list containing filter conditions.
.collapse
How multiple filters are combined.
.limit
The limit.
page_size
The page size.
get_schedule()
Get a schedule.
Connect$get_schedule(schedule_id)
schedule_id
The schedule identifier.
content_create()
Create content.
Connect$content_create(name, title = name, ...)
name
The content name.
title
The content title.
...
Other content fields.
content_upload()
Upload a content bundle.
Connect$content_upload(bundle_path, guid)
bundle_path
The path to the bundle archive.
guid
The content GUID.
content_deploy()
Deploy a content bundle.
Connect$content_deploy(guid, bundle_id)
guid
The content GUID.
bundle_id
The bundle identifier.
content()
Get a content item.
Connect$content( guid = NULL, owner_guid = NULL, name = NULL, include = "tags,owner" )
guid
The content GUID.
owner_guid
The target content owner.
name
The target name.
include
Additional response fields.
task()
Get a task.
Connect$task(task_id, first = 0, wait = 5)
task_id
The task identifier.
first
The initial status position.
wait
Maximum time to wait for update.
set_content_tag()
Set a tag for a content item.
Connect$set_content_tag(content_id, tag_id)
content_id
The content identifier.
tag_id
The tag identifier.
remove_content_tag()
Remove a tag from a content item.
Connect$remove_content_tag(content_id, tag_id)
content_id
The content identifier.
tag_id
The tag identifier.
user()
Get user details.
Connect$user(guid)
guid
The user GUID.
users()
Get users.
Connect$users( page_number = 1, prefix = NULL, page_size = 500, user_role = NULL, account_status = NULL )
page_number
The page number.
prefix
The search term.
page_size
The page size.
user_role
Filter by user role.
account_status
Filter by account status.
users_remote()
Get remote users.
Connect$users_remote(prefix)
prefix
The search term.
users_create()
Create a user.
Connect$users_create( username, email, first_name = NULL, last_name = NULL, password = NULL, user_must_set_password = NULL, user_role = NULL, unique_id = NULL )
username
The username.
email
Email address.
first_name
First name.
last_name
Last name.
password
The password.
user_must_set_password
Indicates that user sets password on first login.
user_role
Role for user.
unique_id
Identifier for user.
users_create_remote()
Create a remote user.
Connect$users_create_remote(temp_ticket)
temp_ticket
Ticket identifying target remote user.
users_lock()
Lock a user.
Connect$users_lock(user_guid)
user_guid
User GUID.
users_unlock()
Unlock a user.
Connect$users_unlock(user_guid)
user_guid
User GUID.
users_update()
Update a user.
Connect$users_update(user_guid, ...)
user_guid
User GUID.
...
User fields.
groups()
Get groups.
Connect$groups(page_number = 1, prefix = NULL, page_size = 500)
page_number
The page number.
prefix
The search term.
page_size
The page size.
group_members()
Get group members.
Connect$group_members(guid)
guid
The group GUID.
group_member_add()
Add a group member.
Connect$group_member_add(group_guid, user_guid)
group_guid
The group GUID.
user_guid
The user GUID.
group_member_remove()
Remove a group member.
Connect$group_member_remove(group_guid, user_guid)
group_guid
The group GUID.
user_guid
The user GUID.
groups_create()
Create a group.
Connect$groups_create(name)
name
The group name.
groups_create_remote()
Create a remote group.
Connect$groups_create_remote(temp_ticket)
temp_ticket
Ticket identifying target remote group.
groups_remote()
Get remote groups.
Connect$groups_remote(prefix = NULL, limit = 500)
prefix
The search term.
limit
The maximal result set size.
group_content()
Get content to which a group has access
Connect$group_content(guid)
guid
The group GUID.
inst_content_visits()
Get (non-interactive) content visits.
Connect$inst_content_visits( content_guid = NULL, min_data_version = NULL, from = NULL, to = NULL, limit = 500, previous = NULL, nxt = NULL, asc_order = TRUE )
content_guid
Content GUID.
min_data_version
Data version for request.
from
Start of range.
to
End of range.
limit
Result set size.
previous
Previous item.
nxt
Next item.
asc_order
Indicates ascending result order.
inst_shiny_usage()
Get interactive content visits.
Get (non-interactive) content visits.
Connect$inst_shiny_usage( content_guid = NULL, min_data_version = NULL, from = NULL, to = NULL, limit = 500, previous = NULL, nxt = NULL, asc_order = TRUE )
content_guid
Content GUID.
min_data_version
Data version for request.
from
Start of range.
to
End of range.
limit
Result set size.
previous
Previous item.
nxt
Next item.
asc_order
Indicates ascending result order.
procs()
Get running processes.
Connect$procs()
repo_account()
Determine if Git repository is associated with authorization.
Connect$repo_account(host)
host
Repository URL.
repo_branches()
Get Git repository branches.
Connect$repo_branches(repo)
repo
Repository URL.
repo_manifest_dirs()
Get Git repository directories.
Connect$repo_manifest_dirs(repo, branch)
repo
Repository URL.
branch
Repository branch.
schedules()
Get schedules.
Connect$schedules( start = Sys.time(), end = Sys.time() + 60 * 60 * 24 * 7, detailed = FALSE )
start
Starting time.
end
Ending time.
detailed
Indicates detailed schedule information.
docs()
Get documentation.
Connect$docs(docs = "api", browse = TRUE)
docs
Named document.
browse
Open a browser.
audit_logs()
Get auditing.
Connect$audit_logs(limit = 500, previous = NULL, nxt = NULL, asc_order = TRUE)
limit
Result set size.
previous
Previous item.
nxt
Next item.
asc_order
Indicates ascending result order.
vanities()
Get all vanity URLs
Connect$vanities()
server_settings_r()
Get R installations.
Connect$server_settings_r()
server_settings()
Get server settings.
Connect$server_settings()
clone()
The objects of this class are cloneable with this method.
Connect$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other R6 classes:
Bundle
,
Content
,
ContentTask
,
Environment
,
Task
,
Vanity
,
Variant
,
VariantSchedule
,
VariantTask
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.