.Renviron
file for repeated useThis 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.
qualtrics_api_credentials(
api_key,
base_url,
overwrite = FALSE,
install = FALSE
)
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
The institution-specific base URL for your Qualtrics account, formatted in quotes. Find your base URL at https://api.qualtrics.com/docs/root-url
If TRUE, will overwrite existing Qualtrics
credentials that you already have in your .Renviron
file.
If TRUE, will install the key in your .Renviron
file
for use in future sessions. Defaults to FALSE (single session use).
# 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 # }