if (FALSE) {
uri <- "https://bbmc.ouhsc.edu/redcap/api/"
token <- "D70F9ACD1EDD6F151C6EA78683944E98" # pid=213
record <- 1
field <- "mugshot"
# event <- "" # only for longitudinal projects
result_1 <- REDCapR::redcap_file_download_oneshot(
record = record,
field = field,
redcap_uri = uri,
token = token
)
base::unlink("mugshot-1.jpg")
(full_name <- base::tempfile(pattern="mugshot", fileext = ".jpg"))
result_2 <- REDCapR::redcap_file_download_oneshot(
file_name = full_name,
record = record,
field = field,
redcap_uri = uri,
token = token
)
base::unlink(full_name)
(relative_name <- "ssss.jpg")
result_3 <- REDCapR::redcap_file_download_oneshot(
file_name = relative_name,
record = record,
field = field,
redcap_uri = uri,
token = token
)
base::unlink(relative_name)
}
Run the code above in your browser using DataLab