|
1 |
| -# redcap-api |
2 |
| -redcap-api is a C# API (Application Programming Interface) for REDCap, that lets you: |
| 1 | +# REDCap API Library for C# |
| 2 | +The REDCap API (Application Programming Interface) for REDCap, lets you: |
3 | 3 | export/import/delete data in REDCap
|
4 | 4 | export/import/delete project information (e.g., field names and types) in REDCap
|
5 | 5 |
|
6 | 6 | __Usage__:
|
7 | 7 |
|
8 | 8 | 1. dotnet restore
|
9 |
| -2. Add reference to library in your project |
10 |
| -3. Add "using Redcap.Interfaces" namespace (contains some enums for redcap optional params) |
| 9 | +2. Add reference to the library in your project |
| 10 | +3. Add "using Redcap" namespace |
11 | 11 | 4. instantiate a new instance of the redcapapi object
|
12 | 12 |
|
13 | 13 | __Example__
|
14 | 14 | ```C#
|
15 | 15 |
|
16 |
| -var rc = new Redcap.RedcapApi("redcap token here", "your redcap api endpoint here") |
| 16 | +using System; |
| 17 | +using Newtonsoft.Json; |
| 18 | +using Redcap; |
| 19 | +using Redcap.Models; |
17 | 20 |
|
18 |
| -``` |
| 21 | +namespace RedcapApiDemo |
| 22 | +{ |
| 23 | + class Program |
| 24 | + { |
| 25 | + static void Main(string[] args) |
| 26 | + { |
| 27 | + Console.WriteLine("Redcap Api Demo Started!"); |
19 | 28 |
|
20 |
| -```C# |
| 29 | + var redcap_api = new RedcapApi("3D57A7FA57C8A43F6C8803A84BB3957B", "http://localhost/redcap/api/"); |
| 30 | + |
| 31 | + var result = redcap_api.GetRecordAsync("1", RedcapFormat.json, RedcapDataType.flat, ReturnFormat.json, null, null, null, null).Result; |
| 32 | + var data = JsonConvert.DeserializeObject(result); |
| 33 | + Console.WriteLine(data); |
| 34 | + Console.ReadLine(); |
21 | 35 |
|
22 |
| -var version = await rc.GetRedcapVersionAsync(RedcapFormat.json, RedcapDataType.flat); |
| 36 | + } |
| 37 | + } |
| 38 | +} |
23 | 39 |
|
24 | 40 | ```
|
25 | 41 |
|
26 |
| -__Install directly in Package Manager Console__ |
| 42 | +__Install directly in Package Manager Console or Command Line Interface__ |
27 | 43 |
|
28 |
| -``` Install-Package RedcapAPI ``` |
| 44 | +``` Install-Package RedcapAPI -Version 0.2.6-alpha-release ``` |
| 45 | +```dotnet add package RedcapAPI --version 0.2.6-alpha-release ``` |
29 | 46 |
|
30 |
| -__Demo__ |
| 47 | +__DEMO__ |
31 | 48 |
|
32 |
| -https://github.com/cctrbic/redcap-api-demo |
| 49 | +A console project has been included with the source code to get started. |
0 commit comments