50% off | Unlimited Data & AI Learning
Get 50% off unlimited learning

redcapAPI (version 1.1)

deleteFiles: Deletes a File attached to a Record

Description

This function allows you to remove a document that has been attached to an individual record

Usage

## S3 method for class 'redcapDbConnection':
deleteFiles(rcon, record, field, event, ...)
## S3 method for class 'redcapApiConnection':
deleteFiles(rcon, record, field, event, ..., 
    proj=NULL)

Arguments

rcon
A REDCap connection object as generated by redcapConnection
record
The record ID in which the desired file is stored. Must be length 1.
field
The field name in which the file is stored. Must be length 1.
event
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.
proj
A redcapProject object as created by redcapProjectInfo.
...
Arguments to be passed to other methods

References

Please refer to your institution's API documentation.

Additional details on API parameters are found on the package wiki at https://github.com/nutterb/redcapAPI/wiki/REDCap-API-Parameters

Examples

Run this code
> #*** Note: I cannot provide working examples without
> #*** compromising security.  Instead, I will try to 
> #*** offer up sample code with the matching results
> 
> #*** Create the connection object
> rcon <- redcapConnection(url=[YOUR_REDCAP_URL], token=[API_TOKEN])
> 
>
> #* Delete a file
> deleteFiles(rcon, record=1, field="file_upload", event="event_1_arm_1")
The file was successfully deleted
>

Run the code above in your browser using DataLab