if (FALSE) {
uri <- "https://redcap-dev-2.ouhsc.edu/redcap/api/"
token <- "F9CBFFF78C3D78F641BAE9623F6B7E6A" # simple-write
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