...
Expand |
---|
title | Click here to see the example |
---|
|
Below is an example done using Postman Replace <host> with hostname where REDCap server is deployed Replace <Project API token> with actual API token issued for accessing REDCap project using APIs In response, you should see the REDCap audit log events nicely formatted using JSON. Image RemovedImage Added
The following commands should succeed with printing JSON string on the console. RC_HOST - URL of the REDCap server. E.g. https://redcap.openspecimen.org
RC_DOCROOT - Document root of the REDCap server. E.g. /, /r
OS_PLUGIN - Relative path of the OpenSpecimen REDCap plugin w.r.t document root. E.g. /plugins/openspecimen_plugin.php
Test Project Details Code Block |
---|
$ curl -X POST -D "token=<Project API token>" -d "content=project" -d "format=json" -d "returnFormat=json" $RC_HOST/$RC_DOCROOT/api/
Example command:
curl -X POST -d "token=xxxx" -d "content=project" -d "format=json" -d "returnFormat=json" https://redcap.openspecimen.org/r/api/
// project details JSON
Output
<!DOCTYPE html>
<html>
<head>
<title>REDCap Project</title>
</head>
<body>
........
</body>
</html>
|
Test Events list Code Block |
---|
$ curl -X POST -d "token=<Project API token>" -d "content=event" -d "format=json" -d "returnFormat=json" $RC_HOST/$RC_DOCROOT/$OS_PLUGIN
// events list JSON
Example command:
curl -X POST -d "token=xxxx" -d "content=event" -d "format=json" -d "returnFormat=json" https://redcap.openspecimen.org/r/plugins/openspecimen_plugin.php
Output
>>[{"event_id":"40","day_offset":"1","offset_min":"0","offset_max":"0","event_name":"Event 1","arm_num":"1","repeatable":"0"}] |
|
...
Use the below command to check the version of the plugin installed on the REDCap server-side
PHP plugin version
Code Block |
---|
$ curl -X POST -d "token=<Project API token>" -d "content=version" -d "format=json" -d "returnFormat=json" $RC_HOST/$RC_DOCROOT/$OS_PLUGIN
Example command:
curl -X POST -d "token=xxxx" -d "content=version" -d "format=json" -d "returnFormat=json" https://redcap.openspecimen.org/r/plugins/openspecimen_plugin.php
Output
>>{"version":"2020-10-12T07:58:48.225Z"} |
...