A single file may be attached to a single record. The behavior of this function is consistent with the behavior of the API, which only allows one file to be uploaded at a time
importFiles(
rcon,
file,
record,
field,
event,
overwrite = TRUE,
repeat_instance = NULL,
...
)# S3 method for redcapApiConnection
importFiles(
rcon,
file,
record,
field,
event = NULL,
overwrite = TRUE,
repeat_instance = NULL,
...,
error_handling = getOption("redcap_error_handling"),
config = list(),
api_param = list()
)
A REDCap connection object as generated by redcapConnection
Character string giving the file path to the file to be imported.
The record ID in which the desired file is stored. Must be length 1.
The field name in which the file is stored. Must be length 1.
The event name for the file. Must be length 1. This applies only to longitudinal projects. If the event is not supplied for a longitudinal project, the API will return an error
Logical. When FALSE
, the function checks if a
file already exists for that record. If a file exists, the function
terminates to prevent overwriting. When TRUE
, no additional
check is performed.
The repeat instance number of the repeating event or the repeating instrument. When available in your instance of REDCap, and passed as NULL, the API will assume a value of 1.
Arguments to be passed to other methods
An option for how to handle errors returned by the API.
see redcap_error
list
Additional configuration parameters to pass to
POST
. These are appended to any parameters in
rcon$config
.
list
Additional API parameters to pass into the
body of the API call. This provides users to execute calls with options
that may not otherwise be supported by redcapAPI
.
Benjamin Nutter
The function may only import a single file