
Last chance! 50% off unlimited learning
Sale ends in
This function is used by other functions to read and write values.
kernel_api(
redcap_uri,
post_body,
config_options,
encoding = "UTF-8",
content_type = "text/csv",
handle_httr = NULL,
encode_httr = "form"
)
The uri/url of the REDCap server typically formatted as "https://server.org/apps/redcap/api/". Required.
List of contents expected by the REDCap API. Required.
A list of options passed to httr::POST()
.
See details at httr::httr_options()
. Optional.
The encoding value passed to httr::content()
. Defaults
to 'UTF-8'.
The MIME value passed to httr::content()
. Defaults
to 'text/csv'.
The value passed to the handle
parameter of
httr::POST()
.
This is useful for only unconventional authentication approaches. It
should be NULL
for most institutions.
The value passed to the encode
parameter of
httr::POST()
.
Defaults to "form"
, which is appropriate for most actions.
(Currently, the only exception is importing a file,
which uses "multipart".)
If the API call is unsuccessful, a value of
base::package_version("0.0.0")
will be returned. This ensures that a
the function will always return an object of class base::package_version.
It guarantees the value can always be used in utils::compareVersion()
.
config_options <- NULL
uri <- "https://redcap-dev-2.ouhsc.edu/redcap/api/"
token <- "9A068C425B1341D69E83064A2D273A70"
post_body <- list(
token = token,
content = "project",
format = "csv"
)
if (FALSE) {
kernel <- REDCapR:::kernel_api(uri, post_body, config_options)
# Consume the results in a few different ways.
kernel$result
read.csv(text = kernel$raw_text)
as.list(read.csv(text = kernel$raw_text))
}
Run the code above in your browser using DataLab