qualtRics (version 3.1.0)

qualtrics_api_credentials: Install Qualtrics credentials in your .Renviron file for repeated use

Description

This function adds your Qualtrics API key and base URL to your .Renviron file so it can be called securely without being stored in your code. After you have installed these two credentials, they can be called any time with Sys.getenv("QUALTRICS_API_KEY") or Sys.getenv("QUALTRICS_BASE_URL"). If you do not have an .Renviron file, the function will create one for you. If you already have an .Renviron file, the function will append the key to your existing file, while making a backup of your original file for disaster recovery purposes.

Usage

qualtrics_api_credentials(api_key, base_url, overwrite = FALSE,
  install = FALSE)

Arguments

api_key

The API key provided to you from Qualtrics formatted in quotes. Learn more about Qualtrics API keys at https://api.qualtrics.com/docs/finding-qualtrics-ids

base_url

The institution-specific base URL for your Qualtrics account, formatted in quotes. Find your base URL at https://api.qualtrics.com/docs/root-url

overwrite

If TRUE, will overwrite existing Qualtrics credentials that you already have in your .Renviron file.

install

If TRUE, will install the key in your .Renviron file for use in future sessions. Defaults to FALSE (single session use).

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
qualtrics_api_credentials(
  api_key = "<YOUR-QUALTRICS_API_KEY>",
  base_url = "<YOUR-QUALTRICS_BASE_URL>",
  install = TRUE
)
# Reload your environment so you can use the credentials without restarting R
readRenviron("~/.Renviron")
# You can check it with:
Sys.getenv("QUALTRICS_API_KEY")

# If you need to overwrite existing credentials:
qualtrics_api_credentials(
  api_key = "<YOUR-QUALTRICS_API_KEY>",
  base_url = "<YOUR-QUALTRICS_BASE_URL>",
  overwrite = TRUE,
  install = TRUE
)
# Reload your environment to use the credentials
# }

Run the code above in your browser using DataCamp Workspace