A single file from a single record is retrieved. The behavior of this function is consistent with the behavior of the API, which only allows one file to be downloaded at a time
exportFiles(rcon, record, field, event = NULL, dir, filePrefix = TRUE, ...)# S3 method for redcapApiConnection
exportFiles(
rcon,
record,
field,
event = NULL,
dir,
filePrefix = TRUE,
repeat_instance = NULL,
...,
error_handling = getOption("redcap_error_handling"),
config = list(),
api_param = list()
)
A REDCap connection object as generated by redcapConnection
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 message
A directory/folder to which the file will be saved. By default, the working directory is used
Logical. Determines if a prefix is appended to the file name. The prefix takes the form [record_id]-[event_name]-[file_name]. The file name is always the same name of the file as it exists in REDCap
Arguments to be passed to other methods
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.
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
.
This method allows you to download a document that has been attached to an individual record for a File Upload field. Please note that this method may also be used for Signature fields (i.e. File Upload fields with "signature" validation type).
Note about export rights: Please be aware that Data Export user rights will be applied to this API request. For example, if you have "No Access" data export rights in the project, then the API file export will fail and return an error. And if you have "De-Identified" or "Remove all tagged Identifier fields" data export rights, then the API file export will fail and return an error *only if* the File Upload field has been tagged as an Identifier field. To make sure that your API request does not return an error, you should have "Full Data Set" export rights in the project.
5.8.2+
None
Benjamin Nutter
The function may only export a single file. See the examples for suggestions on exporting multiple files.
Note that the name of the file can not be changed. Whatever name exists in REDCap is the name that will be used, although the record ID and event name may be appended as a prefix
Please refer to your institution's API documentation.
Additional details on API parameters are found on the package wiki at https://github.com/vubiostat/redcapAPI/wiki/REDCap-API-Parameters