An R Plumber project for demonstrating processing data from a REDCap Data Entry Trigger (DET)
This project specifically uses the Programatic method for defining the API, as opposed to the annotation method
To deploy this you must have configured a server using the rsconnect library, then use the deployAPI function. Note this API is a minimal example and has not been built to perform any security checks you may require. These are often handled on the hosting site itself. Use at your own risk.
The function det_endpoint has a handler that when deployed onto a hosting platform,
will accept POST requests and print to the console the POST request body
The request will be structured like this:
list(
redcap_url = "<your REDCap instance URL>",
project_url = "<the full URL to your project which called the DET>",
project_id = "<your project ID which called the DET>",
username = "<the REDCap username that saved the change to the record>",
record = "<the record ID that was updated/created>",
instrument = "<the instrument that was updated>",
<instrument name>_complete = "<instrument completion status: 0/1/2 etc>"
)
The function det_endpoint can be modified to begin any processing of the request object
buisness logic requires.