Skip to contents

This function deletes one or more records from a REDCap project using the REDCap API. It sends a `delete` action request for each specified record and ensures that only records present in the database are processed.

Usage

delete_REDCap_records(DB, records)

Arguments

DB

A validated `DB` object containing REDCap project data and settings. Generated using load_DB or setup_DB

records

A character vector of record IDs to be deleted from the REDCap project.

Value

NULL. The function does not return a value but will print a message confirming deletion.

Details

The function checks whether the records to be deleted are included in the `DB$summary$all_records` list. If any records are not found, an error is thrown. Otherwise, the function proceeds to delete each specified record from the REDCap project via the REDCap API. The `delete` action is executed using the `httr::POST` method, sending the necessary request to the REDCap server.