All Projects → rstudio → connectapi

rstudio / connectapi

Licence: Unknown, MIT licenses found Licenses found Unknown LICENSE MIT LICENSE.md
An R package for interacting with the RStudio Connect Server API

Programming Languages

r
7636 projects
Makefile
30231 projects

Projects that are alternatives of or similar to connectapi

bitflyer-api-dotnet-client
bitFlyer HTTP APIs Client Library for .NET (C#)
Stars: ✭ 23 (-11.54%)
Mutual labels:  api-client
dnsimple-python
The DNSimple API client for Python.
Stars: ✭ 66 (+153.85%)
Mutual labels:  api-client
kdecole-api
Unofficial Node.js API client of Kdecole (Skolengo EMS)
Stars: ✭ 31 (+19.23%)
Mutual labels:  api-client
jacky
🐄 HTTP JSON API Client for Laravel & Lumen
Stars: ✭ 17 (-34.62%)
Mutual labels:  api-client
v-shopware-api-client
The reliable way to import and update a bazillion products.
Stars: ✭ 20 (-23.08%)
Mutual labels:  api-client
Jib.jl
A Julia implementation of Interactive Brokers API
Stars: ✭ 42 (+61.54%)
Mutual labels:  api-client
cells-client
Command line client to communicate with cells REST api.
Stars: ✭ 17 (-34.62%)
Mutual labels:  api-client
tiktok-scraper-php
Tiktok (Musically) PHP scraper
Stars: ✭ 65 (+150%)
Mutual labels:  api-client
braze-php-sdk
A PHP client to interact with Braze API
Stars: ✭ 15 (-42.31%)
Mutual labels:  api-client
NClient
💫 NClient is an automatic type-safe .Net HTTP client that allows you to call web service API methods using annotated interfaces or controllers without boilerplate code.
Stars: ✭ 25 (-3.85%)
Mutual labels:  api-client
Clamor
The Python Discord API Framework
Stars: ✭ 14 (-46.15%)
Mutual labels:  api-client
backlog kit
Client library for the Nulab's Backlog API version 2 written in Ruby.
Stars: ✭ 28 (+7.69%)
Mutual labels:  api-client
closeio-api
Python API Client for Close
Stars: ✭ 53 (+103.85%)
Mutual labels:  api-client
pyFireEye
Python API bindings for FireEye Products
Stars: ✭ 12 (-53.85%)
Mutual labels:  api-client
jellyfin-apiclient-python
Python API Client for Jellyfin
Stars: ✭ 30 (+15.38%)
Mutual labels:  api-client
my api client
A framework of Web API Client. Provides features error handling, retrying, pagination and so on.
Stars: ✭ 19 (-26.92%)
Mutual labels:  api-client
pywnedpasswords
Checkt pwnedpasswords.com in a secure way
Stars: ✭ 22 (-15.38%)
Mutual labels:  api-client
echovr api docs
Unofficial documentation for Echo VR's HTTP API
Stars: ✭ 19 (-26.92%)
Mutual labels:  api-client
redash-api-client
Redash API Client written in Python
Stars: ✭ 36 (+38.46%)
Mutual labels:  api-client
wporg-client
Standalone HTTP client for public WordPress.org API.
Stars: ✭ 73 (+180.77%)
Mutual labels:  api-client

Lifecycle: maturing CRAN status Codecov test coverage R build status

connectapi

This package provides an R client for the RStudio Connect Server API as well as helpful functions that utilize the client. The package is based on the rsconnnect package, but is publicly exported to be easier to use, is extensible via an R6 class, and is separated from the rsconnect package for easier support and maintenance.

Disclaimer

Because many of these functions are experimental, it is advisable to be cautious about (1) upgrading the package, (2) upgrading RStudio Connect when you care about the reproducibility of workflows that use connectapi. As a result, we would advise:

  • managing package versions with renv
  • test your dependent content before and after upgrading RStudio Connect

Please pay careful attention to the lifecycle badges of the various functions and warnings present when you are using experimental features.

Also, please share feedback!! We love hearing how the RStudio Connect Server API is helpful and what additional endpoints would be useful!!

Installation

To install from CRAN:

install.packages("connectapi")

To install the development version:

remotes::install_github('rstudio/connectapi')

Client

To create a client:

library(connectapi)
client <- connect(
  server = 'https://connect.example.com',
  api_key = '<SUPER SECRET API KEY>'
)

You can also define the following environment variables (in a .Renviron file, for instance):

CONNECT_SERVER  = https://connect.example.com
CONNECT_API_KEY = my-secret-api-key

These environment variable values will be used automatically if defined in your R session.

library(connectapi)
client <- connect()

Getting Started

Once a client is defined, you can use it to interact with RStudio Connect.

Exploring Data

You can use the get_ methods to retrieve data from the RStudio Connect server.

library(connectapi)
client <- connect()

# get data
users <- get_users(client)
groups <- get_groups(client)
usage_shiny <- get_usage_shiny(client)
usage_static <- get_usage_static(client)
some_content <- get_content(client)

# get all content
all_content <- get_content(client, limit = Inf)

Deployment

The rsconnect package is usually used for deploying content to Connect. However, if you want to use programmatic deployment with the RStudio Connect Server API, then these connectapi helpers should be useful!

library(connectapi)
client <- connect()

# deploying content
# NOTE: a `manifest.json` should already exist from `rsconnect::writeManifest()`

bundle <- bundle_dir("./path/to/directory")
content <- client %>% 
  deploy(bundle, name = "my-app-name") %>% 
  poll_task()

# set an image for content

content %>% 
  set_image_path("./my/local/image.png")

content %>% 
  set_image_url("http://url.example.com/image.png")

# set image and a vanity URL

content %>%
  set_image_path("./my/local/image.png") %>%
  set_vanity_url("/my-awesome-app")

# change access_type to "anyone"

content$update(access_type = "all")
  
# edit another piece of content

client %>%
  content_item("the-content-guid") %>%
  set_vanity_url("/another-awesome-app")
  
# migrate content to another server

client_prod <- connect(
  server = "prod.example.com",
  api_key = "my-secret-key"
)

prod_bnd <- client %>%
  content_item("the-guid-to-promote") %>%
  download_bundle()

client_prod %>%
  deploy(prod_bnd, title = "Now in Production") %>%
  set_vanity_url("/my-app")

# open a browser to the content item
client_prod %>% browse_dashboard()
client_prod %>% browse_solo()

# open a browser to the docs
client_prod %>% browse_api_docs()

Troubleshooting and FAQ

Access Denied Errors?

This is likely due to either (1) Connect$server or Connect$api_key being defined improperly or (2) you do not have access to the RStudio Connect cluster to do the operation in question

Constant warning about version numbers

This warning is intentionally chatty. While version number mismatches between RStudio Connect and connectapi can be benign, we want you to be clear that connectapi is tightly coupled to a version of RStudio Connect (because RStudio Connect’s APIs change over time).

We strive to:

  • track the latest version of the RStudio Connect API
  • add new features as they come available and have demand
  • maintain backwards compatibility

These priorities are sometimes at odds, and sometimes they create inconsistencies between versions as a result. To mitigate this, we recommend:

  • Track the version of connectapi in use for your applications by using renv
  • Test high value content that uses connectapi before updating connectapi or RStudio Connect
  • Update RStudio Connect to the latest version first when an update to connectapi is needed

Error - Need to update RStudio Connect

As a helpful clarification for users, we have added error messages to API requests when the version implemented in the package specifically introduces a backwards incompatible dependency on older versions of RStudio Connect.

If you get this error message, our recommendation would be:

  • Look at NEWS.md to find the moment the change was introduced
  • Downgrade connectapi to the previous version of the package
  • (Advanced) Use the “blame” feature on GitHub to track commits and find out when the error was introduced

Please feel free to open an Issue if you think there is a bug, or ask a free-form question on RStudio Community

Other ideas for FAQs or Common Issues?

Please submit a PR! We would love to have your contribution!

Code of Conduct

Please note that the connectapi project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].