qualtrics_api_credentials: Install Qualtrics credentials in your '.Renviron' file for...

View source: R/qualtrics_api_credentials.R

qualtrics_api_credentialsR Documentation

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,
  report = 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/

base_url

The institution-specific base URL for your Qualtrics account, formatted in quotes, without the protocol (do not include https://). Find your base URL at https://api.qualtrics.com/

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).

report

If TRUE, ignores other arguments and outputs credentials as a 2-element named vector.

Examples


## 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

## End(Not run)

qualtRics documentation built on Nov. 18, 2022, 5:08 p.m.