From fb08beb689765235983d3d05a25986d7925c24ea Mon Sep 17 00:00:00 2001 From: Michael Tran Date: Mon, 9 Jan 2023 03:06:52 -0500 Subject: [PATCH 1/3] update documentations update with breaking changes -update api parameters -apis are closer to their original redcap implementation update documentation update interfaces --- RedcapApi/Api/RedcapApi.cs | 1398 ++++++++++--------- RedcapApi/Interfaces/IRedcap.cs | 1704 ++++++++++++++++++++++-- RedcapApi/Models/Format.cs | 39 - RedcapApi/Models/RedcapFormat.cs | 3 +- RedcapApi/Models/RedcapReturnFormat.cs | 8 +- RedcapApi/Models/RedcapUser.cs | 88 ++ RedcapApi/Redcap.csproj | 10 +- RedcapApi/Utilities/Utils.cs | 34 +- RedcapApiDemo/Program.cs | 44 +- 9 files changed, 2452 insertions(+), 876 deletions(-) delete mode 100644 RedcapApi/Models/Format.cs diff --git a/RedcapApi/Api/RedcapApi.cs b/RedcapApi/Api/RedcapApi.cs index 7c25a74..6948e26 100644 --- a/RedcapApi/Api/RedcapApi.cs +++ b/RedcapApi/Api/RedcapApi.cs @@ -46,6 +46,10 @@ public class RedcapApi : IRedcap /// The version of redcap that the api is currently interacting with. /// public static string Version; + /// + /// default constructor + /// + /// public RedcapApi(string redcapApiUrl) { _uri = new Uri(redcapApiUrl); @@ -69,9 +73,8 @@ public RedcapApi(string redcapApiUrl, bool useInsecureCertificates = false) } #region Arms /// - /// API Version 1.0.0+ ** - /// From Redcap Version 4.7.0 - /// Export Arms + /// From Redcap Version 4.7.0

+ /// Export Arms

/// This method allows you to export the Arms for a project /// NOTE: This only works for longitudinal projects. ///
@@ -79,11 +82,11 @@ public RedcapApi(string redcapApiUrl, bool useInsecureCertificates = false) /// To use this method, you must have API Export privileges in the project. /// /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. - /// csv, json [default], xml + /// csv, json [default], xml /// an array of arm numbers that you wish to pull events for (by default, all events are pulled) - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Arms for the project in the format specified(only ones with Events available) - public async Task ExportArmsAsync(string token, ReturnFormat returnFormat = ReturnFormat.json, string[] arms = null, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportArmsAsync(string token, RedcapFormat format = RedcapFormat.json, string[] arms = null, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -98,7 +101,7 @@ public async Task ExportArmsAsync(string token, ReturnFormat returnForma { { "token", token }, { "content", Content.Arm.GetDisplayName() }, - { "format", returnFormat.GetDisplayName() } + { "format", format.GetDisplayName() } }; // Optional if (arms?.Length > 0) @@ -109,7 +112,7 @@ public async Task ExportArmsAsync(string token, ReturnFormat returnForma } } // defaults to 'json' - payload.Add("returnFormat", onErrorFormat.GetDisplayName()); + payload.Add("returnFormat", returnFormat.GetDisplayName()); // Execute send request return await this.SendPostRequestAsync(payload, _uri); @@ -126,9 +129,8 @@ public async Task ExportArmsAsync(string token, ReturnFormat returnForma } /// - /// API Version 1.0.0+ ** - /// From Redcap Version 4.7.0 - /// Export Arms + /// From Redcap Version 4.7.0

+ /// Export Arms

/// This method allows you to export the Arms for a project /// NOTE: This only works for longitudinal projects. ///
@@ -137,11 +139,11 @@ public async Task ExportArmsAsync(string token, ReturnFormat returnForma /// /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. /// arm - /// csv, json [default], xml + /// csv, json [default], xml /// e.g. ["1","2"] an array of arm numbers that you wish to pull events for (by default, all events are pulled) - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Arms for the project in the format specified(only ones with Events available) - public async Task ExportArmsAsync(string token, Content content, ReturnFormat returnFormat = ReturnFormat.json, string[] arms = null, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportArmsAsync(string token, Content content = Content.Arm, RedcapFormat format = RedcapFormat.json, string[] arms = null, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -156,7 +158,7 @@ public async Task ExportArmsAsync(string token, Content content, ReturnF { { "token", token }, { "content", content.GetDisplayName() }, - { "format", returnFormat.GetDisplayName() } + { "format", format.GetDisplayName() } }; // Optional if (arms?.Length > 0) @@ -167,7 +169,7 @@ public async Task ExportArmsAsync(string token, Content content, ReturnF } } // defaults to 'json' - payload.Add("returnFormat", onErrorFormat.GetDisplayName()); + payload.Add("returnFormat", returnFormat.GetDisplayName()); // Execute send request return await this.SendPostRequestAsync(payload, _uri); @@ -184,10 +186,9 @@ public async Task ExportArmsAsync(string token, Content content, ReturnF } /// - /// API Version 1.0.0+ - /// From Redcap Version 4.7.0 + /// From Redcap Version 4.7.0

/// - /// Import Arms + /// Import Arms

/// This method allows you to import Arms into a project or to rename existing Arms in a project. /// You may use the parameter override=1 as a 'delete all + import' action in order to erase all existing Arms in the project while importing new Arms. /// Notice: Because of the 'override' parameter's destructive nature, this method may only use override=1 for projects in Development status. @@ -209,7 +210,7 @@ public async Task ExportArmsAsync(string token, Content content, ReturnF /// /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'xml'. /// Number of Arms imported - public async Task ImportArmsAsync(string token, Override overrideBhavior, RedcapAction action, ReturnFormat format, List data, OnErrorFormat returnFormat = OnErrorFormat.json) + public async Task ImportArmsAsync(string token, Override overrideBhavior, RedcapAction action, RedcapFormat format, List data, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -243,10 +244,9 @@ public async Task ImportArmsAsync(string token, Override overrideBhav } /// - /// API Version 1.0.0+ - /// From Redcap Version 4.7.0 + /// From Redcap Version 4.7.0

/// - /// Import Arms + /// Import Arms

/// This method allows you to import Arms into a project or to rename existing Arms in a project. /// You may use the parameter override=1 as a 'delete all + import' action in order to erase all existing Arms in the project while importing new Arms. /// Notice: Because of the 'override' parameter's destructive nature, this method may only use override=1 for projects in Development status. @@ -269,7 +269,7 @@ public async Task ImportArmsAsync(string token, Override overrideBhav /// /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'xml'. /// Number of Arms imported - public async Task ImportArmsAsync(string token, Content content, Override overrideBhavior, RedcapAction action, ReturnFormat format, List data, OnErrorFormat returnFormat) + public async Task ImportArmsAsync(string token, Content content, Override overrideBhavior, RedcapAction action, RedcapFormat format, List data, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -303,10 +303,9 @@ public async Task ImportArmsAsync(string token, Content content, Over } /// - /// API Version 1.0.0+ - /// From Redcap Version 4.7.0 + /// From Redcap Version 4.7.0

/// - /// Delete Arms + /// Delete Arms

/// This method allows you to delete Arms from a project. /// Notice: Because of this method's destructive nature, it is only available for use for projects in Development status. Additionally, please be aware that deleting an arm also automatically deletes all events that belong to that arm, and will also automatically delete any records/data that have been collected under that arm (this is non-reversible data loss). /// NOTE: This only works for longitudinal projects. @@ -327,7 +326,7 @@ public async Task DeleteArmsAsync(string token, string[] arms) this.CheckToken(token); if (arms.Length < 1) { - throw new InvalidOperationException($"No arm to delete, specify arm"); + throw new ArgumentNullException($"No arm to delete, please specify arm"); } var payload = new Dictionary @@ -372,7 +371,7 @@ public async Task DeleteArmsAsync(string token, string[] arms) /// delete /// an array of arm numbers that you wish to delete /// Number of Arms deleted - public async Task DeleteArmsAsync(string token, Content content, RedcapAction action, string[] arms) + public async Task DeleteArmsAsync(string token, Content content = Content.Event, RedcapAction action = RedcapAction.Delete, string[] arms = default) { try { @@ -382,7 +381,7 @@ public async Task DeleteArmsAsync(string token, Content content, RedcapA this.CheckToken(token); if (arms.Length < 1) { - throw new InvalidOperationException($"No arm to delete, specify arm"); + throw new ArgumentNullException($"No arm to delete, please specify arm"); } var payload = new Dictionary @@ -413,8 +412,7 @@ public async Task DeleteArmsAsync(string token, Content content, RedcapA #region Data Access Groups /// - /// POST - /// Export DAGs + /// Export DAGs

/// This method allows you to export the Data Access Groups for a project /// /// To use this method, you must have API Export privileges in the project. @@ -423,9 +421,9 @@ public async Task DeleteArmsAsync(string token, Content content, RedcapA /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. /// dag /// csv, json [default], xml - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// DAGs for the project in the format specified - public async Task ExportDagsAsync(string token, Content content, ReturnFormat format = ReturnFormat.json, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportDagsAsync(string token, Content content = Content.Dag, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { var exportDagsResults = string.Empty; try @@ -439,7 +437,7 @@ public async Task ExportDagsAsync(string token, Content content, ReturnF { "token", token }, { "content", content.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; exportDagsResults = await this.SendPostRequestAsync(payload, _uri); return exportDagsResults; @@ -453,7 +451,6 @@ public async Task ExportDagsAsync(string token, Content content, ReturnF } /// - /// POST /// Import DAGs /// This method allows you to import new DAGs (Data Access Groups) into a project or update the group name of any existing DAGs. /// NOTE: DAGs can be renamed by simply changing the group name(data_access_group_name). @@ -478,9 +475,9 @@ public async Task ExportDagsAsync(string token, Content content, ReturnF /// "FL Site",fl_site /// "New Site", /// - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Number of DAGs added or updated - public async Task ImportDagsAsync(string token, Content content, RedcapAction action, ReturnFormat format, List data, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ImportDagsAsync(string token, Content content, RedcapAction action, RedcapFormat format, List data, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { var importDagsResults = string.Empty; try @@ -495,7 +492,7 @@ public async Task ImportDagsAsync(string token, Content content, Redc { "content", content.GetDisplayName() }, { "action", action.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() }, + { "returnFormat", returnFormat.GetDisplayName() }, { "data", _serializedData } }; // Execute request @@ -510,8 +507,7 @@ public async Task ImportDagsAsync(string token, Content content, Redc } /// - /// POST - /// Delete DAGs + /// Delete DAGs

/// This method allows you to delete DAGs from a project. /// /// To use this method, you must have API Import/Update privileges in the project. @@ -556,11 +552,11 @@ public async Task DeleteDagsAsync(string token, Content content, RedcapA return deleteDagsResult; } } - + /// - /// From Redcap Version 11.3.1 + /// From Redcap Version 11.3.1

/// - /// Switch DAG + /// Switch DAG

/// This method allows the current API user to switch (assign/reassign/unassign) their current Data Access Group assignment if they have been assigned to multiple DAGs via the DAG Switcher page in the project. /// /// To use this method, you must have API Import/Update privileges in the project. @@ -599,7 +595,7 @@ public async Task SwitchDagAsync(string token, RedcapDag dag, Content co } /// - /// Export User-DAG Assignments + /// Export User-DAG Assignments
/// This method allows you to export existing User-DAG assignments for a project. /// ///
@@ -609,9 +605,9 @@ public async Task SwitchDagAsync(string token, RedcapDag dag, Content co /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. /// userDagMapping /// csv, json [default], xml - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// User-DAG assignments for the project in the format specified - public async Task ExportUserDagAssignmentAsync(string token, Content content, ReturnFormat format = ReturnFormat.json, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportUserDagAssignmentAsync(string token, Content content, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { var exportUserDagAssignmentResult = string.Empty; try @@ -625,7 +621,7 @@ public async Task ExportUserDagAssignmentAsync(string token, Content con { "token", token }, { "content", content.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; exportUserDagAssignmentResult = await this.SendPostRequestAsync(payload, _uri); return exportUserDagAssignmentResult; @@ -638,8 +634,7 @@ public async Task ExportUserDagAssignmentAsync(string token, Content con } } /// - /// POST - /// Import User-DAG Assignments + /// Import User-DAG Assignments

/// This method allows you to assign users to any data access group. /// NOTE: If you wish to modify an existing mapping, you *must* provide its unique username and group name.If the 'redcap_data_access_group' column is not provided, user will not assigned to any group.There should be only one record per username. /// @@ -663,9 +658,9 @@ public async Task ExportUserDagAssignmentAsync(string token, Content con /// fl_dt_person, fl_site /// global_user, /// - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Number of User-DAG assignments added or updated - public async Task ImportUserDagAssignmentAsync(string token, Content content, RedcapAction action, ReturnFormat format, List data, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ImportUserDagAssignmentAsync(string token, Content content, RedcapAction action, RedcapFormat format, List data, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { var ImportUserDagAssignmentResults = string.Empty; try @@ -680,7 +675,7 @@ public async Task ImportUserDagAssignmentAsync(string token, Content { "content", content.GetDisplayName() }, { "action", action.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() }, + { "returnFormat", returnFormat.GetDisplayName() }, { "data", _serializedData } }; // Execute request @@ -697,7 +692,6 @@ public async Task ImportUserDagAssignmentAsync(string token, Content #region Events /// - /// API Version 1.0.0+ /// From Redcap Version 4.7.0 /// /// Export Events @@ -713,9 +707,9 @@ public async Task ImportUserDagAssignmentAsync(string token, Content /// /// csv, json [default], xml /// - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Events for the project in the format specified - public async Task ExportEventsAsync(string token, ReturnFormat format = ReturnFormat.json, string[] arms = null, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportEventsAsync(string token, RedcapFormat format, string[] arms, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -725,7 +719,7 @@ public async Task ExportEventsAsync(string token, ReturnFormat format = this.CheckToken(token); if (arms.Length < 1) { - throw new InvalidOperationException($"Please specify the arm you wish to export the events from."); + throw new ArgumentNullException($"Please specify the arm you wish to export the events from."); } var payload = new Dictionary @@ -733,7 +727,7 @@ public async Task ExportEventsAsync(string token, ReturnFormat format = { "token", token }, { "content", Content.Event.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; // Optional if (arms?.Length > 0) @@ -758,10 +752,9 @@ public async Task ExportEventsAsync(string token, ReturnFormat format = } /// - /// API Version 1.0.0+ - /// From Redcap Version 6.11.0 + /// From Redcap Version 6.11.0

/// - /// Export Events + /// Export Events

/// This method allows you to export the events for a project /// NOTE: This only works for longitudinal projects. /// @@ -775,9 +768,9 @@ public async Task ExportEventsAsync(string token, ReturnFormat format = /// event /// csv, json [default], xml /// - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Events for the project in the format specified - public async Task ExportEventsAsync(string token, Content content = Content.Event, ReturnFormat format = ReturnFormat.json, string[] arms = null, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportEventsAsync(string token, Content content, RedcapFormat format, string[] arms, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -787,7 +780,7 @@ public async Task ExportEventsAsync(string token, Content content = Cont this.CheckToken(token); if (arms.Length < 1) { - throw new InvalidOperationException($"Please specify the arm you wish to export the events from."); + throw new ArgumentNullException($"Please specify the arm you wish to export the events from."); } var payload = new Dictionary @@ -795,7 +788,7 @@ public async Task ExportEventsAsync(string token, Content content = Cont { "token", token }, { "content", content.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; // Optional if (arms?.Length > 0) @@ -820,8 +813,7 @@ public async Task ExportEventsAsync(string token, Content content = Cont } /// - /// API Version 1.0.0+ - /// From Redcap Version 6.11.0 + /// From Redcap Version 6.11.0

/// /// Import Events /// This method allows you to import Events into a project or to update existing Events' attributes, such as the event name, days offset, etc. The unique event name of an Event cannot be changed because it is auto-generated by REDCap. Please note that the only way to update an existing Event is to provide the unique_event_name attribute, and if the unique_event_name attribute is missing for an Event being imported (when override=0), it will assume it to be a new Event that should be created. Notice: Because of the 'override' parameter's destructive nature, this method may only use override=1 for projects in Development status. @@ -842,9 +834,9 @@ public async Task ExportEventsAsync(string token, Content content = Cont /// "offset_max":"0","unique_event_name":"visit_2_arm_1"}] /// /// csv, json [default], xml - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Number of Events imported - public async Task ImportEventsAsync(string token, Override overRideBehavior, ReturnFormat format, List data, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ImportEventsAsync(string token, Override overRideBehavior, RedcapFormat format, List data, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -854,7 +846,7 @@ public async Task ImportEventsAsync(string token, Override overRideBe this.CheckToken(token); if (data.Count < 1) { - throw new InvalidOperationException($"Events can not be empty or null"); + throw new ArgumentNullException($"Events can not be empty or null"); } var _serializedData = JsonConvert.SerializeObject(data); var payload = new Dictionary @@ -864,7 +856,7 @@ public async Task ImportEventsAsync(string token, Override overRideBe { "action", RedcapAction.Import.GetDisplayName() }, { "format", format.GetDisplayName() }, { "override", overRideBehavior.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() }, + { "returnFormat", returnFormat.GetDisplayName() }, { "data", _serializedData } }; // Execute request @@ -882,10 +874,9 @@ public async Task ImportEventsAsync(string token, Override overRideBe } /// - /// API Version 1.0.0+ - /// From Redcap Version 6.11.0 + /// From Redcap Version 6.11.0

/// - /// Import Events + /// Import Events

/// This method allows you to import Events into a project or to update existing Events' attributes, such as the event name, days offset, etc. The unique event name of an Event cannot be changed because it is auto-generated by REDCap. Please note that the only way to update an existing Event is to provide the unique_event_name attribute, and if the unique_event_name attribute is missing for an Event being imported (when override=0), it will assume it to be a new Event that should be created. Notice: Because of the 'override' parameter's destructive nature, this method may only use override=1 for projects in Development status. /// NOTE: This only works for longitudinal projects. ///
@@ -895,7 +886,7 @@ public async Task ImportEventsAsync(string token, Override overRideBe /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. /// event /// import - /// 0 - false [default], 1 - true — You may use override=1 as a 'delete all + import' action in order to erase all existing Events in the project while importing new Events. If override=0, then you can only add new Events or modify existing ones. + /// 0 - false [default], 1 - true — You may use override=1 as a 'delete all + import' action in order to erase all existing Events in the project while importing new Events. If override=0, then you can only add new Events or modify existing ones. /// /// Contains the required attributes 'event_name' (referring to the name/label of the event) and 'arm_num' (referring to the arm number to which the event belongs - assumes '1' if project only contains one arm). In order to modify an existing event, you must provide the attribute 'unique_event_name' (referring to the auto-generated unique event name of the given event). If the project utilizes the Scheduling module, the you may optionally provide the following attributes, which must be numerical: day_offset, offset_min, offset_max. If the day_offset is not provided, then the events will be auto-numbered in the order in which they are provided in the API request. /// [{"event_name":"Baseline","arm_num":"1","day_offset":"1","offset_min":"0", @@ -906,9 +897,9 @@ public async Task ImportEventsAsync(string token, Override overRideBe /// "offset_max":"0","unique_event_name":"visit_2_arm_1"}] /// /// csv, json [default], xml - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Number of Events imported - public async Task ImportEventsAsync(string token, Content content, RedcapAction action, Override overRideBehavior, ReturnFormat format, List data, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ImportEventsAsync(string token, Content content, RedcapAction action, Override overrideBehavior, RedcapFormat format, List data, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -918,7 +909,7 @@ public async Task ImportEventsAsync(string token, Content content, Re this.CheckToken(token); if (data.Count < 1) { - throw new InvalidOperationException($"Events can not be empty or null"); + throw new ArgumentNullException($"Events can not be empty or null"); } var _serializedData = JsonConvert.SerializeObject(data); var payload = new Dictionary @@ -927,8 +918,8 @@ public async Task ImportEventsAsync(string token, Content content, Re { "content", content.GetDisplayName() }, { "action", action.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "override", overRideBehavior.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() }, + { "override", overrideBehavior.GetDisplayName() }, + { "returnFormat", returnFormat.GetDisplayName() }, { "data", _serializedData } }; // Execute request @@ -946,11 +937,10 @@ public async Task ImportEventsAsync(string token, Content content, Re } /// - /// API Version 1.0.0+ - /// From Redcap Version 6.11.0 + /// From Redcap Version 6.11.0

/// - /// Delete Events - /// This method allows you to delete Events from a project. + /// Delete Events

+ /// This method allows you to delete Events from a project.
/// Notice: Because of this method's destructive nature, it is only available for use for projects in Development status. /// Additionally, please be aware that deleting an event will automatically delete any records/data that have been collected under that event (this is non-reversible data loss). /// NOTE: This only works for longitudinal projects. @@ -959,10 +949,10 @@ public async Task ImportEventsAsync(string token, Content content, Re /// /// To use this method, you must have API Import/Update privileges *and* Project Design/Setup privileges in the project. /// - /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. /// Array of unique event names /// Number of Events deleted - public async Task DeleteEventsAsync(string token, string[] events = null) + public async Task DeleteEventsAsync(string token, string[] events) { try { @@ -972,7 +962,7 @@ public async Task DeleteEventsAsync(string token, string[] events = null this.CheckToken(token); if (events.Length < 1) { - throw new InvalidOperationException($"No events to delete..."); + throw new ArgumentNullException($"No events to delete..."); } var payload = new Dictionary @@ -1004,11 +994,10 @@ public async Task DeleteEventsAsync(string token, string[] events = null } /// - /// API Version 1.0.0+ - /// From Redcap Version 6.11.0 + /// From Redcap Version 6.11.0

/// - /// Delete Events - /// This method allows you to delete Events from a project. + /// Delete Events

+ /// This method allows you to delete Events from a project.
/// Notice: Because of this method's destructive nature, it is only available for use for projects in Development status. /// Additionally, please be aware that deleting an event will automatically delete any records/data that have been collected under that event (this is non-reversible data loss). /// NOTE: This only works for longitudinal projects. @@ -1017,12 +1006,12 @@ public async Task DeleteEventsAsync(string token, string[] events = null /// /// To use this method, you must have API Import/Update privileges *and* Project Design/Setup privileges in the project. /// - /// - /// - /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// event + /// delete /// Array of unique event names /// Number of Events deleted - public async Task DeleteEventsAsync(string token, Content content, RedcapAction action, string[] events = null) + public async Task DeleteEventsAsync(string token, Content content, RedcapAction action, string[] events) { try { @@ -1066,13 +1055,13 @@ public async Task DeleteEventsAsync(string token, Content content, Redca #region Field Names /// - /// Export List of Export Field Names (i.e. variables used during exports and imports) + /// Export List of Export Field Names (i.e. variables used during exports and imports)

/// /// This method returns a list of the export/import-specific version of field names for all fields (or for one field, if desired) in a project. /// This is mostly used for checkbox fields because during data exports and data imports, checkbox fields have a different variable name used than the exact one defined for them in the Online Designer and Data Dictionary, in which *each checkbox option* gets represented as its own export field name in the following format: field_name + triple underscore + converted coded value for the choice. /// For non-checkbox fields, the export field name will be exactly the same as the original field name. /// Note: The following field types will be automatically removed from the list returned by this method since they cannot be utilized during the data import process: 'calc', 'file', and 'descriptive'. - /// + ///

/// The list that is returned will contain the three following attributes for each field/choice: 'original_field_name', 'choice_value', and 'export_field_name'. /// The choice_value attribute represents the raw coded value for a checkbox choice.For non-checkbox fields, the choice_value attribute will always be blank/empty. /// The export_field_name attribute represents the export/import-specific version of that field name. @@ -1083,12 +1072,12 @@ public async Task DeleteEventsAsync(string token, Content content, Redca /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. /// csv, json [default], xml /// A field's variable name. By default, all fields are returned, but if field is provided, then it will only the export field name(s) for that field. If the field name provided is invalid, it will return an error. - /// csv, json [default], xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json [default], xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// The list that is returned will contain the original field name (variable) of the field and also the export field name(s) of that field. /// Returns a list of the export/import-specific version of field names for all fields (or for one field, if desired) in a project in the format specified and ordered by their field order . /// The list that is returned will contain the three following attributes for each field/choice: 'original_field_name', 'choice_value', and 'export_field_name'. The choice_value attribute represents the raw coded value for a checkbox choice. For non-checkbox fields, the choice_value attribute will always be blank/empty. The export_field_name attribute represents the export/import-specific version of that field name. /// - public async Task ExportFieldNamesAsync(string token, ReturnFormat format = ReturnFormat.json, string field = null, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportFieldNamesAsync(string token, RedcapFormat format = RedcapFormat.json, string field = default, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -1101,7 +1090,7 @@ public async Task ExportFieldNamesAsync(string token, ReturnFormat forma { "token", token }, { "content", Content.ExportFieldNames.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; if (!IsNullOrEmpty(field)) @@ -1123,13 +1112,13 @@ public async Task ExportFieldNamesAsync(string token, ReturnFormat forma /// - /// Export List of Export Field Names (i.e. variables used during exports and imports) + /// Export List of Export Field Names (i.e. variables used during exports and imports)

/// /// This method returns a list of the export/import-specific version of field names for all fields (or for one field, if desired) in a project. /// This is mostly used for checkbox fields because during data exports and data imports, checkbox fields have a different variable name used than the exact one defined for them in the Online Designer and Data Dictionary, in which *each checkbox option* gets represented as its own export field name in the following format: field_name + triple underscore + converted coded value for the choice. /// For non-checkbox fields, the export field name will be exactly the same as the original field name. /// Note: The following field types will be automatically removed from the list returned by this method since they cannot be utilized during the data import process: 'calc', 'file', and 'descriptive'. - /// + ///

/// The list that is returned will contain the three following attributes for each field/choice: 'original_field_name', 'choice_value', and 'export_field_name'. /// The choice_value attribute represents the raw coded value for a checkbox choice.For non-checkbox fields, the choice_value attribute will always be blank/empty. /// The export_field_name attribute represents the export/import-specific version of that field name. @@ -1141,12 +1130,12 @@ public async Task ExportFieldNamesAsync(string token, ReturnFormat forma /// exportFieldNames /// csv, json [default], xml /// A field's variable name. By default, all fields are returned, but if field is provided, then it will only the export field name(s) for that field. If the field name provided is invalid, it will return an error. - /// csv, json [default], xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json [default], xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// The list that is returned will contain the original field name (variable) of the field and also the export field name(s) of that field. /// Returns a list of the export/import-specific version of field names for all fields (or for one field, if desired) in a project in the format specified and ordered by their field order . /// The list that is returned will contain the three following attributes for each field/choice: 'original_field_name', 'choice_value', and 'export_field_name'. The choice_value attribute represents the raw coded value for a checkbox choice. For non-checkbox fields, the choice_value attribute will always be blank/empty. The export_field_name attribute represents the export/import-specific version of that field name. /// - public async Task ExportFieldNamesAsync(string token, Content content = Content.ExportFieldNames, ReturnFormat format = ReturnFormat.json, string field = null, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportFieldNamesAsync(string token, Content content = Content.ExportFieldNames, RedcapFormat format = RedcapFormat.json, string field = null, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -1159,7 +1148,7 @@ public async Task ExportFieldNamesAsync(string token, Content content = { "token", token }, { "content", content.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; if (!IsNullOrEmpty(field)) @@ -1182,13 +1171,16 @@ public async Task ExportFieldNamesAsync(string token, Content content = #region Files /// - /// API Version 1.0.0+ - /// Export a File + /// Export a File

/// This method allows you to download a document that has been attached to an individual record for a File Upload field. Please note that this method may also be used for Signature fields (i.e. File Upload fields with 'signature' validation type). /// Note about export rights: Please be aware that Data Export user rights will be applied to this API request.For example, if you have 'No Access' data export rights in the project, then the API file export will fail and return an error. And if you have 'De-Identified' or 'Remove all tagged Identifier fields' data export rights, then the API file export will fail and return an error *only if* the File Upload field has been tagged as an Identifier field.To make sure that your API request does not return an error, you should have 'Full Data Set' export rights in the project. + ///

+ /// How to obtain the filename of the file: + /// The MIME type of the file, along with the name of the file and its extension, can be found in the header of the returned response.Thus in order to determine these attributes of the file being exported, you will need to parse the response header. Example: content-type = application / vnd.openxmlformats - officedocument.wordprocessingml.document; name='FILE_NAME.docx' ///
/// - /// To use this method, you must have API Export privileges in the project. + /// To use this method, you must have API Export privileges in the project.
+ /// ///
/// /// The MIME type of the file, along with the name of the file and its extension, can be found in the header of the returned response. Thus in order to determine these attributes of the file being exported, you will need to parse the response header. Example: content-type = application/vnd.openxmlformats-officedocument.wordprocessingml.document; name='FILE_NAME.docx' @@ -1198,10 +1190,10 @@ public async Task ExportFieldNamesAsync(string token, Content content = /// the name of the field that contains the file /// the unique event name - only for longitudinal projects /// (only for projects with repeating instruments/events) The repeat instance number of the repeating event (if longitudinal) or the repeating instrument (if classic or longitudinal). Default value is '1'. - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'xml'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'xml'. /// File path which the file will be saved. /// the contents of the file - public async Task ExportFileAsync(string token, string record, string field, string eventName, string repeatInstance = "1", OnErrorFormat onErrorFormat = OnErrorFormat.json, string filePath = null) + public async Task ExportFileAsync(string token, string record, string field, string eventName, string repeatInstance = "1", RedcapReturnFormat returnFormat = RedcapReturnFormat.json, string filePath = null) { try { @@ -1223,15 +1215,15 @@ public async Task ExportFileAsync(string token, string record, string fi } if (IsNullOrEmpty(record)) { - throw new InvalidOperationException($"No record provided to export"); + throw new ArgumentNullException($"No record provided to export"); } if (IsNullOrEmpty(field) || IsNullOrEmpty(eventName)) { - throw new InvalidOperationException($"No field provided to export"); + throw new ArgumentNullException($"No field provided to export"); } if (IsNullOrEmpty(eventName)) { - throw new InvalidOperationException($"No eventName provided to export"); + throw new ArgumentNullException($"No eventName provided to export"); } var payload = new Dictionary { @@ -1241,7 +1233,7 @@ public async Task ExportFileAsync(string token, string record, string fi { "record", record }, { "field", field }, { "event", eventName }, - { "returnFormat", onErrorFormat.GetDisplayName() }, + { "returnFormat", returnFormat.GetDisplayName() }, { "repeat_instance", repeatInstance } }; // Execute request @@ -1259,14 +1251,16 @@ public async Task ExportFileAsync(string token, string record, string fi } /// - /// API Version 1.0.0+ - /// Export a File - /// **Allows for file download to a path.** + /// Export a File

/// This method allows you to download a document that has been attached to an individual record for a File Upload field. Please note that this method may also be used for Signature fields (i.e. File Upload fields with 'signature' validation type). /// Note about export rights: Please be aware that Data Export user rights will be applied to this API request.For example, if you have 'No Access' data export rights in the project, then the API file export will fail and return an error. And if you have 'De-Identified' or 'Remove all tagged Identifier fields' data export rights, then the API file export will fail and return an error *only if* the File Upload field has been tagged as an Identifier field.To make sure that your API request does not return an error, you should have 'Full Data Set' export rights in the project. + ///

+ /// How to obtain the filename of the file: + /// The MIME type of the file, along with the name of the file and its extension, can be found in the header of the returned response.Thus in order to determine these attributes of the file being exported, you will need to parse the response header. Example: content-type = application / vnd.openxmlformats - officedocument.wordprocessingml.document; name='FILE_NAME.docx' ///
/// - /// To use this method, you must have API Export privileges in the project. + /// To use this method, you must have API Export privileges in the project.
+ /// ///
/// /// The MIME type of the file, along with the name of the file and its extension, can be found in the header of the returned response. Thus in order to determine these attributes of the file being exported, you will need to parse the response header. Example: content-type = application/vnd.openxmlformats-officedocument.wordprocessingml.document; name='FILE_NAME.docx' @@ -1281,7 +1275,7 @@ public async Task ExportFileAsync(string token, string record, string fi /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'xml'. /// File path which the file will be saved. /// the file name that was exported - public async Task ExportFileAsync(string token, Content content, RedcapAction action, string record, string field, string eventName, string repeatInstance = "1", OnErrorFormat onErrorFormat = OnErrorFormat.json, string filePath = null) + public async Task ExportFileAsync(string token, Content content, RedcapAction action, string record, string field, string eventName, string repeatInstance = "1", RedcapReturnFormat onErrorFormat = RedcapReturnFormat.json, string filePath = null) { try { @@ -1331,8 +1325,7 @@ public async Task ExportFileAsync(string token, Content content, RedcapA } /// - /// API Version 1.0.0+ - /// Import a File + /// Import a File

/// This method allows you to upload a document that will be attached to an individual record for a File Upload field. Please note that this method may NOT be used for Signature fields (i.e. File Upload fields with 'signature' validation type) because a signature can only be captured and stored using the web interface. ///
/// @@ -1346,9 +1339,9 @@ public async Task ExportFileAsync(string token, Content content, RedcapA /// (only for projects with repeating instruments/events) The repeat instance number of the repeating event (if longitudinal) or the repeating instrument (if classic or longitudinal). Default value is '1'. /// The File you be imported, contents of the file /// the path where the file is located - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'xml'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'xml'. /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. - public async Task ImportFileAsync(string token, string record, string field, string eventName, string repeatInstance, string fileName, string filePath, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ImportFileAsync(string token, string record, string field, string eventName, string repeatInstance, string fileName, string filePath, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -1368,7 +1361,7 @@ public async Task ImportFileAsync(string token, string record, string fi {new StringContent(record), "record" }, {new StringContent(field), "field" }, {new StringContent(eventName), "event" }, - {new StringContent(onErrorFormat.GetDisplayName()), "returnFormat" } + {new StringContent(returnFormat.GetDisplayName()), "returnFormat" } }; if (!IsNullOrEmpty(repeatInstance)) { @@ -1389,7 +1382,7 @@ public async Task ImportFileAsync(string token, string record, string fi else { // add the binary file in specific content type - _fileContent = new ByteArrayContent(File.ReadAllBytes(_binaryFile)); + _fileContent = new ByteArrayContent(System.IO.File.ReadAllBytes(_binaryFile)); _fileContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); payload.Add(_fileContent, "file", _fileName); } @@ -1407,8 +1400,7 @@ public async Task ImportFileAsync(string token, string record, string fi } /// - /// API Version 1.0.0+ - /// Import a File + /// Import a File

/// This method allows you to upload a document that will be attached to an individual record for a File Upload field. Please note that this method may NOT be used for Signature fields (i.e. File Upload fields with 'signature' validation type) because a signature can only be captured and stored using the web interface. ///
/// @@ -1424,9 +1416,9 @@ public async Task ImportFileAsync(string token, string record, string fi /// (only for projects with repeating instruments/events) The repeat instance number of the repeating event (if longitudinal) or the repeating instrument (if classic or longitudinal). Default value is '1'. /// The File you be imported, contents of the file /// the path where the file is located - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'xml'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'xml'. /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. - public async Task ImportFileAsync(string token, Content content, RedcapAction action, string record, string field, string eventName, string repeatInstance, string fileName, string filePath, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ImportFileAsync(string token, Content content, RedcapAction action, string record, string field, string eventName, string repeatInstance, string fileName, string filePath, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -1446,7 +1438,7 @@ public async Task ImportFileAsync(string token, Content content, RedcapA {new StringContent(record), "record" }, {new StringContent(field), "field" }, {new StringContent(eventName), "event" }, - {new StringContent(onErrorFormat.GetDisplayName()), "returnFormat" } + {new StringContent(returnFormat.GetDisplayName()), "returnFormat" } }; if (!IsNullOrEmpty(repeatInstance)) { @@ -1467,7 +1459,7 @@ public async Task ImportFileAsync(string token, Content content, RedcapA else { // add the binary file in specific content type - _fileContent = new ByteArrayContent(File.ReadAllBytes(_binaryFile)); + _fileContent = new ByteArrayContent(System.IO.File.ReadAllBytes(_binaryFile)); _fileContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); payload.Add(_fileContent, "file", _fileName); } @@ -1485,8 +1477,7 @@ public async Task ImportFileAsync(string token, Content content, RedcapA } /// - /// API Version 1.0.0+ - /// Delete a File + /// Delete a File

/// This method allows you to remove a document that has been attached to an individual record for a File Upload field. Please note that this method may also be used for Signature fields (i.e. File Upload fields with 'signature' validation type). ///
/// @@ -1497,9 +1488,9 @@ public async Task ImportFileAsync(string token, Content content, RedcapA /// the name of the field that contains the file /// the unique event name - only for longitudinal projects /// (only for projects with repeating instruments/events) The repeat instance number of the repeating event (if longitudinal) or the repeating instrument (if classic or longitudinal). Default value is '1'. - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// String - public async Task DeleteFileAsync(string token, string record, string field, string eventName, string repeatInstance, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task DeleteFileAsync(string token, string record, string field, string eventName, string repeatInstance, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -1515,7 +1506,7 @@ public async Task DeleteFileAsync(string token, string record, string fi {new StringContent(record), "record" }, {new StringContent(field), "field" }, {new StringContent(eventName), "event" }, - {new StringContent(onErrorFormat.GetDisplayName()), "returnFormat" } + {new StringContent(returnFormat.GetDisplayName()), "returnFormat" } }; if (!IsNullOrEmpty(repeatInstance)) { @@ -1541,8 +1532,7 @@ public async Task DeleteFileAsync(string token, string record, string fi } /// - /// API Version 1.0.0+ - /// Delete a File + /// Delete a File

/// This method allows you to remove a document that has been attached to an individual record for a File Upload field. Please note that this method may also be used for Signature fields (i.e. File Upload fields with 'signature' validation type). ///
/// @@ -1555,9 +1545,9 @@ public async Task DeleteFileAsync(string token, string record, string fi /// the name of the field that contains the file /// the unique event name - only for longitudinal projects /// (only for projects with repeating instruments/events) The repeat instance number of the repeating event (if longitudinal) or the repeating instrument (if classic or longitudinal). Default value is '1'. - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// String - public async Task DeleteFileAsync(string token, Content content, RedcapAction action, string record, string field, string eventName, string repeatInstance, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task DeleteFileAsync(string token, Content content, RedcapAction action, string record, string field, string eventName, string repeatInstance, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -1573,7 +1563,7 @@ public async Task DeleteFileAsync(string token, Content content, RedcapA {new StringContent(record), "record" }, {new StringContent(field), "field" }, {new StringContent(eventName), "event" }, - {new StringContent(onErrorFormat.GetDisplayName()), "returnFormat" } + {new StringContent(returnFormat.GetDisplayName()), "returnFormat" } }; if (!IsNullOrEmpty(repeatInstance)) { @@ -1598,119 +1588,344 @@ public async Task DeleteFileAsync(string token, Content content, RedcapA } } #endregion Files - #region Instruments + #region File Repository /// - /// API Version 1.0.0+ - /// Export Instruments (Data Entry Forms) - /// This method allows you to export a list of the data collection instruments for a project. - /// This includes their unique instrument name as seen in the second column of the Data Dictionary, as well as each instrument's corresponding instrument label, which is seen on a project's left-hand menu when entering data. The instruments will be ordered according to their order in the project. + /// From Redcap Version 13.1

+ /// + /// Create a New Folder in the File Repository

+ /// + /// This method allows you to create a new folder in the File Repository.
+ /// You may optionally provide the folder_id of the parent folder under which you wish this folder to be created.
+ /// Providing a dag_id and/or role_id will allow you to restrict access to only users within a specific DAG (Data Access Group) or User Role, respectively. + /// ///
+ /// /// - /// To use this method, you must have API Export privileges in the project. + /// To use this method, you must have API Import/Update privileges and File Repository privileges in the project. /// /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// fileRepository + /// createFolder + /// The desired name of the folder to be created (max length = 150 characters) /// csv, json [default], xml - /// Instruments for the project in the format specified and will be ordered according to their order in the project. - public async Task ExportInstrumentsAsync(string token, ReturnFormat format = ReturnFormat.json) + /// the folder_id of a specific folder in the File Repository for which you wish to create this sub-folder. If none is provided, the folder will be created in the top-level directory of the File Repository. + /// the dag_id of the DAG (Data Access Group) to which you wish to restrict access for this folder. If none is provided, the folder will accessible to users in all DAGs and users in no DAGs. + /// the role_id of the User Role to which you wish to restrict access for this folder. If none is provided, the folder will accessible to users in all User Roles and users in no User Roles. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// + /// The folder_id of the new folder created in the specified format.
For example, if using format=json, the output would look similar to this: [{folder_id:45}].
+ public async Task CreateFolderFileRepositoryAsync(string token, Content content, RedcapAction action, string name, RedcapFormat format, string folderId = default, string dagId = default, string roleId = default, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { - try + /* + * Check the required parameters for empty or null + */ + if (IsNullOrEmpty(token)) { - /* - * Check for presence of token - */ - this.CheckToken(token); - var payload = new Dictionary - { - { "token", token }, - { "content", Content.Instrument.GetDisplayName() }, - { "format", format.GetDisplayName() } - }; - // Execute request - return await this.SendPostRequestAsync(payload, _uri); + throw new ArgumentNullException("Please provide a valid Redcap token."); } - catch (Exception Ex) + if (IsNullOrEmpty(name)) { - /* - * We'll just log the error and return the error message. - */ - Log.Error($"{Ex.Message}"); - return Ex.Message; + throw new ArgumentNullException("Please provide a valid name for the folder to create in the Repository."); + } + var payload = new Dictionary + { + { "token", token }, + { "content", content.GetDisplayName() }, + { "action", action.GetDisplayName() }, + { "format", format.GetDisplayName() }, + { "returnFormat", returnFormat.GetDisplayName() } + }; + // Optional + if (!IsNullOrEmpty(folderId)) + { + payload.Add("folder_id", folderId); + } + if (!IsNullOrEmpty(dagId)) + { + payload.Add("dag_id", dagId); + } + if (!IsNullOrEmpty(roleId)) + { + payload.Add("role_id", roleId); } - } + // Execute send request + return await this.SendPostRequestAsync(payload, _uri); + + } /// - /// API Version 1.0.0+ - /// Export Instruments (Data Entry Forms) - /// This method allows you to export a list of the data collection instruments for a project. - /// This includes their unique instrument name as seen in the second column of the Data Dictionary, as well as each instrument's corresponding instrument label, which is seen on a project's left-hand menu when entering data. The instruments will be ordered according to their order in the project. + /// From Redcap Version 13.1
+ /// + /// Export a List of Files/Folders from the File Repository

+ /// ///
/// - /// To use this method, you must have API Export privileges in the project. + /// To use this method, you must have API Export privileges and File Repository privileges in the project. /// /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. - /// instrument + /// fileRepository + /// list /// csv, json [default], xml - /// Instruments for the project in the format specified and will be ordered according to their order in the project. - public async Task ExportInstrumentsAsync(string token, Content content = Content.Instrument, ReturnFormat format = ReturnFormat.json) + /// the folder_id of a specific folder in the File Repository for which you wish to export a list of its files and sub-folders. If none is provided, the top-level directory of the File Repository will be used. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// The list of all files and folders within a given sub-folder in the File Repository in the format specified. + public async Task ExportFilesFoldersFileRepositoryAsync(string token, Content content = Content.FileRepository, RedcapAction action = RedcapAction.List, RedcapFormat format = RedcapFormat.json, string folderId = null, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { - try + /* + * Check the required parameters for empty or null + */ + if (IsNullOrEmpty(token)) { - /* - * Check for presence of token - */ - this.CheckToken(token); - var payload = new Dictionary - { - { "token", token }, - { "content", content.GetDisplayName() }, - { "format", format.GetDisplayName() } - }; - // Execute request - return await this.SendPostRequestAsync(payload, _uri); + throw new ArgumentNullException("Please provide a valid Redcap token."); } - catch (Exception Ex) + var payload = new Dictionary { - /* - * We'll just log the error and return the error message. - */ - Log.Error($"{Ex.Message}"); - return Ex.Message; + { "token", token }, + { "content", content.GetDisplayName() }, + { "action", action.GetDisplayName() }, + { "format", format.GetDisplayName() }, + { "returnFormat", returnFormat.GetDisplayName() } + }; + // Optional + if (!IsNullOrEmpty(folderId)) + { + payload.Add("folder_id", folderId); } - } + // Execute send request + return await this.SendPostRequestAsync(payload, _uri); + } /// - /// API Version 1.0.0+ - /// From Redcap Version 6.4.0 - /// Export PDF file of Data Collection Instruments (either as blank or with data) - /// This method allows you to export a PDF file for any of the following: 1) a single data collection instrument (blank), 2) all instruments (blank), 3) a single instrument (with data from a single record), 4) all instruments (with data from a single record), or 5) all instruments (with data from ALL records). - /// This is the exact same PDF file that is downloadable from a project's data entry form in the web interface, and additionally, the user's privileges with regard to data exports will be applied here just like they are when downloading the PDF in the web interface (e.g., if they have de-identified data export rights, then it will remove data from certain fields in the PDF). - /// If the user has 'No Access' data export rights, they will not be able to use this method, and an error will be returned. + /// From Redcap Version 13.1
+ /// Export a File from the File Repository
///
/// - /// To use this method, you must have API Export privileges in the project. + /// To use this method, you must have API Export privileges and File Repository privileges in the project. /// /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. - /// the record ID. The value is blank by default. If record is blank, it will return the PDF as blank (i.e. with no data). If record is provided, it will return a single instrument or all instruments containing data from that record only. - /// the unique event name - only for longitudinal projects. For a longitudinal project, if record is not blank and event is blank, it will return data for all events from that record. If record is not blank and event is not blank, it will return data only for the specified event from that record. - /// the unique instrument name as seen in the second column of the Data Dictionary. The value is blank by default, which returns all instruments. If record is not blank and instrument is blank, it will return all instruments for that record. - /// [The value of this parameter does not matter and is ignored.] If this parameter is passed with any value, it will export all instruments (and all events, if longitudinal) with data from all records. Note: If this parameter is passed, the parameters record, event, and instrument will be ignored. - /// csv, json [default] , xml- The returnFormat is only used with regard to the format of any error messages that might be returned. - /// A PDF file containing one or all data collection instruments from the project, in which the instruments will be blank (no data), contain data from a single record, or contain data from all records in the project, depending on the parameters passed in the API request. - public async Task ExportPDFInstrumentsAsync(string token, string recordId = null, string eventName = null, string instrument = null, bool allRecord = false, OnErrorFormat onErrorFormat = OnErrorFormat.json) + /// fileRepository + /// export + /// the doc_id of the file in the File Repository + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// the contents of the file + public async Task ExportFileFileRepositoryAsync(string token, Content content, RedcapAction action, string docId = default, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { - try + /* + * Check the required parameters for empty or null + */ + if (IsNullOrEmpty(token)) { - /* - * Check for presence of token - */ - this.CheckToken(token); - + throw new ArgumentNullException("Please provide a valid Redcap token."); + } + var payload = new Dictionary + { + { "token", token }, + { "content", content.GetDisplayName() }, + { "action", action.GetDisplayName() }, + { "returnFormat", returnFormat.GetDisplayName() } + }; + // Optional + if (!IsNullOrEmpty(docId)) + { + payload.Add("doc_id", docId); + } + + // Execute send request + return await this.SendPostRequestAsync(payload, _uri); + } + /// + /// From Redcap Version 13.1
+ /// Import a File into the File Repository
+ /// + ///
+ /// + /// To use this method, you must have API Import/Update privileges and File Repository privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// fileRepository + /// import + /// the contents of the file + /// the folder_id of a specific folder in the File Repository where you wish to store the file. If none is provided, the file will be stored in the top-level directory of the File Repository. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// string + public async Task ImportFileRepositoryAsync(string token, Content content = Content.FileRepository, RedcapAction action = RedcapAction.Import, string file = null, string folderId = null, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) + { + /* + * Check the required parameters for empty or null + */ + if (IsNullOrEmpty(token)) + { + throw new ArgumentNullException("Please provide a valid Redcap token."); + } + if (IsNullOrEmpty(file)) + { + throw new ArgumentNullException("Please provide a file to import."); + } + var payload = new Dictionary + { + { "token", token }, + { "content", content.GetDisplayName() }, + { "action", action.GetDisplayName() }, + { "returnFormat", returnFormat.GetDisplayName() } + }; + // Optional + if (!IsNullOrEmpty(folderId)) + { + payload.Add("folder_id", folderId); + } + + // Execute send request + return await this.SendPostRequestAsync(payload, _uri); + } + /// + /// From Redcap Version 13.1
+ /// Delete a File from the File Repository
+ /// + ///
+ /// + /// To use this method, you must have API Import/Update privileges and File Repository privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// fileRepository + /// delete + /// the doc_id of the file in the File Repository + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// string + public async Task DeleteFileRepositoryAsync(string token, Content content = Content.FileRepository, RedcapAction action = RedcapAction.Delete, string docId = null, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) + { + /* + * Check the required parameters for empty or null + */ + if (IsNullOrEmpty(token)) + { + throw new ArgumentNullException("Please provide a valid Redcap token."); + } + if (IsNullOrEmpty(docId)) + { + throw new ArgumentNullException("Please provide a document id to delete."); + } + var payload = new Dictionary + { + { "token", token }, + { "content", content.GetDisplayName() }, + { "action", action.GetDisplayName() }, + { "returnFormat", returnFormat.GetDisplayName() } + }; + // Execute send request + return await this.SendPostRequestAsync(payload, _uri); + } + #endregion File Repository + #region Instruments + + /// + /// Export Instruments (Data Entry Forms)

+ /// This method allows you to export a list of the data collection instruments for a project. + /// This includes their unique instrument name as seen in the second column of the Data Dictionary, as well as each instrument's corresponding instrument label, which is seen on a project's left-hand menu when entering data. The instruments will be ordered according to their order in the project. + ///
+ /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// csv, json [default], xml + /// Instruments for the project in the format specified and will be ordered according to their order in the project. + public async Task ExportInstrumentsAsync(string token, RedcapFormat format = RedcapFormat.json) + { + try + { + /* + * Check for presence of token + */ + this.CheckToken(token); + var payload = new Dictionary + { + { "token", token }, + { "content", Content.Instrument.GetDisplayName() }, + { "format", format.GetDisplayName() } + }; + // Execute request + return await this.SendPostRequestAsync(payload, _uri); + } + catch (Exception Ex) + { + /* + * We'll just log the error and return the error message. + */ + Log.Error($"{Ex.Message}"); + return Ex.Message; + } + } + + /// + /// Export Instruments (Data Entry Forms)
+ /// This method allows you to export a list of the data collection instruments for a project. + /// This includes their unique instrument name as seen in the second column of the Data Dictionary, as well as each instrument's corresponding instrument label, which is seen on a project's left-hand menu when entering data. The instruments will be ordered according to their order in the project. + ///
+ /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// instrument + /// csv, json [default], xml + /// Instruments for the project in the format specified and will be ordered according to their order in the project. + public async Task ExportInstrumentsAsync(string token, Content content = Content.Instrument, RedcapFormat format = RedcapFormat.json) + { + try + { + /* + * Check for presence of token + */ + this.CheckToken(token); + var payload = new Dictionary + { + { "token", token }, + { "content", content.GetDisplayName() }, + { "format", format.GetDisplayName() } + }; + // Execute request + return await this.SendPostRequestAsync(payload, _uri); + } + catch (Exception Ex) + { + /* + * We'll just log the error and return the error message. + */ + Log.Error($"{Ex.Message}"); + return Ex.Message; + } + } + + /// + /// From Redcap Version 6.4.0

+ /// Export PDF file of Data Collection Instruments (either as blank or with data)

+ /// This method allows you to export a PDF file for any of the following: 1) a single data collection instrument (blank), 2) all instruments (blank), 3) a single instrument (with data from a single record), 4) all instruments (with data from a single record), or 5) all instruments (with data from ALL records). + /// This is the exact same PDF file that is downloadable from a project's data entry form in the web interface, and additionally, the user's privileges with regard to data exports will be applied here just like they are when downloading the PDF in the web interface (e.g., if they have de-identified data export rights, then it will remove data from certain fields in the PDF). + /// If the user has 'No Access' data export rights, they will not be able to use this method, and an error will be returned. + ///
+ /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// the record ID. The value is blank by default. If record is blank, it will return the PDF as blank (i.e. with no data). If record is provided, it will return a single instrument or all instruments containing data from that record only. + /// the unique event name - only for longitudinal projects. For a longitudinal project, if record is not blank and event is blank, it will return data for all events from that record. If record is not blank and event is not blank, it will return data only for the specified event from that record. + /// the unique instrument name as seen in the second column of the Data Dictionary. The value is blank by default, which returns all instruments. If record is not blank and instrument is blank, it will return all instruments for that record. + /// [The value of this parameter does not matter and is ignored.] If this parameter is passed with any value, it will export all instruments (and all events, if longitudinal) with data from all records. Note: If this parameter is passed, the parameters record, event, and instrument will be ignored. + /// csv, json [default] , xml- The returnFormat is only used with regard to the format of any error messages that might be returned. + /// A PDF file containing one or all data collection instruments from the project, in which the instruments will be blank (no data), contain data from a single record, or contain data from all records in the project, depending on the parameters passed in the API request. + public async Task ExportPDFInstrumentsAsync(string token, string recordId = default, string eventName = default, string instrument = default, bool allRecord = false, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) + { + try + { + /* + * Check for presence of token + */ + this.CheckToken(token); + var payload = new Dictionary { { "token", token }, { "content", Content.Pdf.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; // Add all optional parameters if (!IsNullOrEmpty(recordId)) @@ -1743,9 +1958,8 @@ public async Task ExportPDFInstrumentsAsync(string token, string recordI } /// - /// API Version 1.0.0+ - /// From Redcap Version 11.4.4 - /// Export PDF file of Data Collection Instruments (either as blank or with data) + /// From Redcap Version 11.4.4

+ /// Export PDF file of Data Collection Instruments (either as blank or with data)

/// This method allows you to export a PDF file for any of the following: 1) a single data collection instrument (blank), 2) all instruments (blank), 3) a single instrument (with data from a single record), 4) all instruments (with data from a single record), or 5) all instruments (with data from ALL records). /// This is the exact same PDF file that is downloadable from a project's data entry form in the web interface, and additionally, the user's privileges with regard to data exports will be applied here just like they are when downloading the PDF in the web interface (e.g., if they have de-identified data export rights, then it will remove data from certain fields in the PDF). /// If the user has 'No Access' data export rights, they will not be able to use this method, and an error will be returned. @@ -1762,7 +1976,7 @@ public async Task ExportPDFInstrumentsAsync(string token, string recordI /// Set to TRUE to return a compact-formatted PDF that excludes fields that have no data saved and excludes unselected multiple choice options, thus producing a smaller PDF file. If set to FALSE, all fields will be displayed normally. /// csv, json [default] , xml- The returnFormat is only used with regard to the format of any error messages that might be returned. /// A PDF file containing one or all data collection instruments from the project, in which the instruments will be blank (no data), contain data from a single record, or contain data from all records in the project, depending on the parameters passed in the API request. - public async Task ExportPDFInstrumentsAsync(string token, Content content = Content.Pdf, string recordId = null, string eventName = null, string instrument = null, bool allRecords = false, bool compactDisplay = false, OnErrorFormat returnFormat = OnErrorFormat.json) + public async Task ExportPDFInstrumentsAsync(string token, Content content = Content.Pdf, string recordId = default, string eventName = default, string instrument = default, bool allRecords = false, bool compactDisplay = false, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -1812,10 +2026,9 @@ public async Task ExportPDFInstrumentsAsync(string token, Content conten } /// - /// API Version 1.0.0+ - /// From Redcap Version 6.4.0 + /// From Redcap Version 6.4.0
/// **Allows for file download to a path.** - /// Export PDF file of Data Collection Instruments (either as blank or with data) + /// Export PDF file of Data Collection Instruments (either as blank or with data)
/// This method allows you to export a PDF file for any of the following: 1) a single data collection instrument (blank), 2) all instruments (blank), 3) a single instrument (with data from a single record), 4) all instruments (with data from a single record), or 5) all instruments (with data from ALL records). /// This is the exact same PDF file that is downloadable from a project's data entry form in the web interface, and additionally, the user's privileges with regard to data exports will be applied here just like they are when downloading the PDF in the web interface (e.g., if they have de-identified data export rights, then it will remove data from certain fields in the PDF). /// If the user has 'No Access' data export rights, they will not be able to use this method, and an error will be returned. @@ -1829,9 +2042,9 @@ public async Task ExportPDFInstrumentsAsync(string token, Content conten /// the unique instrument name as seen in the second column of the Data Dictionary. The value is blank by default, which returns all instruments. If record is not blank and instrument is blank, it will return all instruments for that record. /// [The value of this parameter does not matter and is ignored.] If this parameter is passed with any value, it will export all instruments (and all events, if longitudinal) with data from all records. Note: If this parameter is passed, the parameters record, event, and instrument will be ignored. /// the path where the file is located - /// csv, json [default] , xml- The returnFormat is only used with regard to the format of any error messages that might be returned. + /// csv, json [default] , xml- The returnFormat is only used with regard to the format of any error messages that might be returned. /// A PDF file containing one or all data collection instruments from the project, in which the instruments will be blank (no data), contain data from a single record, or contain data from all records in the project, depending on the parameters passed in the API request. - public async Task ExportPDFInstrumentsAsync(string token, string recordId = null, string eventName = null, string instrument = null, bool allRecord = false, string filePath = null, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportPDFInstrumentsAsync(string token, string recordId = default, string eventName = default, string instrument = default, bool allRecord = false, string filePath = default, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -1851,7 +2064,7 @@ public async Task ExportPDFInstrumentsAsync(string token, string recordI { { "token", token }, { "content", Content.Pdf.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() }, + { "returnFormat", returnFormat.GetDisplayName() }, { "filePath", $@"{filePath}" } }; // Add all optional parameters @@ -1885,10 +2098,9 @@ public async Task ExportPDFInstrumentsAsync(string token, string recordI } /// - /// API Version 1.0.0+ - /// From Redcap Version 4.7.0 + /// From Redcap Version 4.7.0

/// - /// Export Instrument-Event Mappings + /// Export Instrument-Event Mappings

/// This method allows you to export the instrument-event mappings for a project (i.e., how the data collection instruments are designated for certain events in a longitudinal project). /// NOTE: This only works for longitudinal projects. ///
@@ -1898,9 +2110,9 @@ public async Task ExportPDFInstrumentsAsync(string token, string recordI /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. /// csv, json [default], xml /// an array of arm numbers that you wish to pull events for (by default, all events are pulled) - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Instrument-event mappings for the project in the format specified - public async Task ExportInstrumentMappingAsync(string token, ReturnFormat format = ReturnFormat.json, string[] arms = null, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportInstrumentMappingAsync(string token, RedcapFormat format = RedcapFormat.json, string[] arms = default, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -1913,7 +2125,7 @@ public async Task ExportInstrumentMappingAsync(string token, ReturnForma { "token", token }, { "content", Content.FormEventMapping.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; // Add all optional parameters if (arms?.Length > 0) @@ -1937,10 +2149,9 @@ public async Task ExportInstrumentMappingAsync(string token, ReturnForma } /// - /// API Version 1.0.0+ - /// From Redcap Version 4.7.0 + /// From Redcap Version 4.7.0

/// - /// Export Instrument-Event Mappings + /// Export Instrument-Event Mappings

/// This method allows you to export the instrument-event mappings for a project (i.e., how the data collection instruments are designated for certain events in a longitudinal project). /// NOTE: This only works for longitudinal projects. ///
@@ -1951,9 +2162,9 @@ public async Task ExportInstrumentMappingAsync(string token, ReturnForma /// formEventMapping /// csv, json [default], xml /// an array of arm numbers that you wish to pull events for (by default, all events are pulled) - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Instrument-event mappings for the project in the format specified - public async Task ExportInstrumentMappingAsync(string token, Content content = Content.FormEventMapping, ReturnFormat format = ReturnFormat.json, string[] arms = null, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportInstrumentMappingAsync(string token, Content content, RedcapFormat format, string[] arms = default, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -1966,7 +2177,7 @@ public async Task ExportInstrumentMappingAsync(string token, Content con { "token", token }, { "content", content.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; // Add all optional parameters if (arms?.Length > 0) @@ -1990,28 +2201,27 @@ public async Task ExportInstrumentMappingAsync(string token, Content con } /// - /// API Version 1.0.0+ - /// FFrom Redcap Version 4.7.0 + /// From Redcap Version 4.7.0

/// - /// Import Instrument-Event Mappings + /// Import Instrument-Event Mappings

/// This method allows you to import Instrument-Event Mappings into a project (this corresponds to the 'Designate Instruments for My Events' page in the project). /// NOTE: This only works for longitudinal projects. ///
/// /// To use this method, you must have API Import/Update privileges *and* Project Design/Setup privileges in the project. /// + /// /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. /// csv, json [default], xml - /// /// Contains the attributes 'arm_num' (referring to the arm number), 'unique_event_name' (referring to the auto-generated unique event name of the given event), and 'form' (referring to the unique form name of the given data collection instrument), in which they are provided in the specified format. /// JSON Example:[{"arm_num":"1","unique_event_name":"baseline_arm_1","form":"demographics"}, /// {"arm_num":"1","unique_event_name":"visit_1_arm_1","form":"day_3"}, /// {"arm_num":"1","unique_event_name":"visit_1_arm_1","form":"other"}, /// {"arm_num":"1","unique_event_name":"visit_2_arm_1","form":"other"}] /// - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Number of Instrument-Event Mappings imported - public async Task ImportInstrumentMappingAsync(string token, ReturnFormat format, List data, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ImportInstrumentMappingAsync(string token, RedcapFormat format, List data, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -2026,7 +2236,7 @@ public async Task ImportInstrumentMappingAsync(string token, ReturnFo { "token", token }, { "content", Content.FormEventMapping.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() }, + { "returnFormat", returnFormat.GetDisplayName() }, { "data", _serializedData } }; // Execute request @@ -2043,29 +2253,28 @@ public async Task ImportInstrumentMappingAsync(string token, ReturnFo } /// - /// API Version 1.0.0+ - /// From Redcap Version 4.7.0 + /// From Redcap Version 4.7.0

/// - /// Import Instrument-Event Mappings + /// Import Instrument-Event Mappings

/// This method allows you to import Instrument-Event Mappings into a project (this corresponds to the 'Designate Instruments for My Events' page in the project). /// NOTE: This only works for longitudinal projects. ///
/// /// To use this method, you must have API Import/Update privileges *and* Project Design/Setup privileges in the project. /// + /// /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. /// formEventMapping /// csv, json [default], xml - /// /// Contains the attributes 'arm_num' (referring to the arm number), 'unique_event_name' (referring to the auto-generated unique event name of the given event), and 'form' (referring to the unique form name of the given data collection instrument), in which they are provided in the specified format. /// JSON Example:[{"arm_num":"1","unique_event_name":"baseline_arm_1","form":"demographics"}, /// {"arm_num":"1","unique_event_name":"visit_1_arm_1","form":"day_3"}, /// {"arm_num":"1","unique_event_name":"visit_1_arm_1","form":"other"}, /// {"arm_num":"1","unique_event_name":"visit_2_arm_1","form":"other"}] /// - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Number of Instrument-Event Mappings imported - public async Task ImportInstrumentMappingAsync(string token, Content content, ReturnFormat format, List data, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ImportInstrumentMappingAsync(string token, Content content, RedcapFormat format, List data, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -2080,7 +2289,7 @@ public async Task ImportInstrumentMappingAsync(string token, Content { "token", token }, { "content", content.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() }, + { "returnFormat", returnFormat.GetDisplayName() }, { "data", _serializedData } }; // Execute request @@ -2098,14 +2307,14 @@ public async Task ImportInstrumentMappingAsync(string token, Content #endregion Instruments #region Logging /// - /// API @Version 10.8 - /// POST - /// Export Logging + /// From Redcap Version 10.8
+ /// Export Logging
/// This method allows you to export the logging (audit trail) of all changes made to this project, including data exports, data changes, project metadata changes, modification of user rights, etc. + ///
KEY:
Filter by event (logtype):
export = Data export,
manage = Manage/Design,
user = User or role created-updated-deleted,
record = Record created-updated-deleted,
record_add = Record created (only),
record_edit = Record updated(only),
record_delete = Record deleted(only),
lock_record = Record locking and e-signatures,
page_view = Page View + ///
/// - /// To use this method, you must have API Export privileges in the project. + /// To use this method, you must have API Export privileges *and* Logging privileges in the project. /// - ///
/// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. /// log /// csv, json [default], xml @@ -2115,9 +2324,9 @@ public async Task ImportInstrumentMappingAsync(string token, Content /// To return only the events belong to specific DAG (referring to group_id), provide a dag. If not specified, it will assume all dags. /// To return only the events that have been logged *after* a given date/time, provide a timestamp in the format YYYY-MM-DD HH:MM (e.g., '2017-01-01 17:00' for January 1, 2017 at 5:00 PM server time). If not specified, it will assume no begin time. /// To return only records that have been logged *before* a given date/time, provide a timestamp in the format YYYY-MM-DD HH:MM (e.g., '2017-01-01 17:00' for January 1, 2017 at 5:00 PM server time). If not specified, it will use the current server time. - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// List of all changes made to this project, including data exports, data changes, and the creation or deletion of users. - public async Task ExportLoggingAsync(string token, Content content, ReturnFormat format = ReturnFormat.json, LogType logType = LogType.All, string user = null, string record = null, string dag = null, string beginTime = null, string endTime = null, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportLoggingAsync(string token, Content content, RedcapFormat format = RedcapFormat.json, LogType logType = LogType.All, string user = default, string record = default, string dag = default, string beginTime = default, string endTime = default, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { var exportLoggingResults = string.Empty; try @@ -2130,28 +2339,28 @@ public async Task ExportLoggingAsync(string token, Content content, Retu { "token", token }, { "content", content.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() }, + { "returnFormat", returnFormat.GetDisplayName() }, { "logtype", logType.GetDisplayName() } }; // Optional - if (!string.IsNullOrEmpty(user)) + if (!IsNullOrEmpty(user)) { payload.Add("user", user); } - if (!string.IsNullOrEmpty(record)) + if (!IsNullOrEmpty(record)) { payload.Add("record", record); } - if (!string.IsNullOrEmpty(dag)) + if (!IsNullOrEmpty(dag)) { payload.Add("dag", dag); } - if (!string.IsNullOrEmpty(beginTime)) + if (!IsNullOrEmpty(beginTime)) { payload.Add("beginTime", beginTime); } - if (!string.IsNullOrEmpty(endTime)) + if (!IsNullOrEmpty(endTime)) { payload.Add("endTime", endTime); } @@ -2167,9 +2376,8 @@ public async Task ExportLoggingAsync(string token, Content content, Retu #endregion #region Metadata /// - /// API Version 1.0.0+ - /// From Redcap Version 3.4.0+ - /// Export Metadata (Data Dictionary) + /// From Redcap Version 3.4.0+

+ /// Export Metadata (Data Dictionary)
/// This method allows you to export the metadata for a project ///
/// @@ -2180,9 +2388,9 @@ public async Task ExportLoggingAsync(string token, Content content, Retu /// csv, json [default], xml /// an array of field names specifying specific fields you wish to pull (by default, all metadata is pulled) /// an array of form names specifying specific data collection instruments for which you wish to pull metadata (by default, all metadata is pulled). NOTE: These 'forms' are not the form label values that are seen on the webpages, but instead they are the unique form names seen in Column B of the data dictionary. - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Metadata from the project (i.e. Data Dictionary values) in the format specified ordered by the field order - public async Task ExportMetaDataAsync(string token, Content content = Content.MetaData, ReturnFormat format = ReturnFormat.json, string[] fields = null, string[] forms = null, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportMetaDataAsync(string token, Content content, RedcapFormat format, string[] fields = default, string[] forms = default, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -2195,7 +2403,7 @@ public async Task ExportMetaDataAsync(string token, Content content = Co { "token", token }, { "content", content.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; // Optional if (fields?.Length > 0) @@ -2224,8 +2432,7 @@ public async Task ExportMetaDataAsync(string token, Content content = Co } } /// - /// API Version 1.0.0+ - /// From Redcap Version 3.4.0+ + /// From Redcap Version 3.4.0+

/// Export Metadata (Data Dictionary) /// This method allows you to export the metadata for a project ///
@@ -2236,9 +2443,9 @@ public async Task ExportMetaDataAsync(string token, Content content = Co /// csv, json [default], xml /// an array of field names specifying specific fields you wish to pull (by default, all metadata is pulled) /// an array of form names specifying specific data collection instruments for which you wish to pull metadata (by default, all metadata is pulled). NOTE: These 'forms' are not the form label values that are seen on the webpages, but instead they are the unique form names seen in Column B of the data dictionary. - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Metadata from the project (i.e. Data Dictionary values) in the format specified ordered by the field order - public async Task ExportMetaDataAsync(string token, ReturnFormat format = ReturnFormat.json, string[] fields = null, string[] forms = null, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportMetaDataAsync(string token, RedcapFormat format = RedcapFormat.json, string[] fields = default, string[] forms = default, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -2251,7 +2458,7 @@ public async Task ExportMetaDataAsync(string token, ReturnFormat format { "token", token }, { "content", Content.MetaData.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; // Optional if (fields?.Length > 0) @@ -2280,10 +2487,9 @@ public async Task ExportMetaDataAsync(string token, ReturnFormat format } } /// - /// API Version 1.0.0+ - /// From Redcap Version 6.11.0 + /// From Redcap Version 6.11.0

/// - /// Import Metadata (Data Dictionary) + /// Import Metadata (Data Dictionary)

/// /// This method allows you to import metadata (i.e., Data Dictionary) into a project. Notice: Because of this method's destructive nature, it is only available for use for projects in Development status. ///
@@ -2294,9 +2500,9 @@ public async Task ExportMetaDataAsync(string token, ReturnFormat format /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. /// csv, json [default], xml /// The formatted data to be imported. - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Number of fields imported - public async Task ImportMetaDataAsync(string token, ReturnFormat format, List data, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ImportMetaDataAsync(string token, RedcapFormat format, List data, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -2310,7 +2516,7 @@ public async Task ImportMetaDataAsync(string token, ReturnFormat form { "token", token }, { "content", Content.MetaData.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() }, + { "returnFormat", returnFormat.GetDisplayName() }, { "data", _serializedData } }; return await this.SendPostRequestAsync(payload, _uri); @@ -2326,10 +2532,9 @@ public async Task ImportMetaDataAsync(string token, ReturnFormat form } /// - /// API Version 1.0.0+ - /// From Redcap Version 6.11.0 + /// From Redcap Version 6.11.0

/// - /// Import Metadata (Data Dictionary) + /// Import Metadata (Data Dictionary)

/// /// This method allows you to import metadata (i.e., Data Dictionary) into a project. Notice: Because of this method's destructive nature, it is only available for use for projects in Development status. ///
@@ -2341,9 +2546,9 @@ public async Task ImportMetaDataAsync(string token, ReturnFormat form /// metadata /// csv, json [default], xml /// The formatted data to be imported. - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Number of fields imported - public async Task ImportMetaDataAsync(string token, Content content, ReturnFormat format, List data, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ImportMetaDataAsync(string token, Content content, RedcapFormat format, List data, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -2357,7 +2562,7 @@ public async Task ImportMetaDataAsync(string token, Content content, { "token", token }, { "content", content.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() }, + { "returnFormat", returnFormat.GetDisplayName() }, { "data", _serializedData } }; return await this.SendPostRequestAsync(payload, _uri); @@ -2374,10 +2579,9 @@ public async Task ImportMetaDataAsync(string token, Content content, #endregion Metadata #region Projects /// - /// API Version 1.0.0+ - /// From Redcap Version 6.11.0 + /// From Redcap Version 6.11.0

/// - /// Create A New Project + /// Create A New Project
/// /// This method allows you to create a new REDCap project. A 64-character Super API Token is required for this method (as opposed to project-level API methods that require a regular 32-character token associated with the project-user). In the API request, you must minimally provide the project attributes 'project_title' and 'purpose' (with numerical value 0=Practice/Just for fun, 1=Other, 2=Research, 3=Quality Improvement, 4=Operational Support) when creating a project. /// When a project is created with this method, the project will automatically be given all the project-level defaults just as if you created a new empty project via the web user interface, such as a automatically creating a single data collection instrument seeded with a single Record ID field and Form Status field, as well as (for longitudinal projects) one arm with one event. And if you intend to create your own arms or events immediately after creating the project, it is recommended that you utilize the override=1 parameter in the 'Import Arms' or 'Import Events' method, respectively, so that the default arm and event are removed when you add your own.Also, the user creating the project will automatically be added to the project as a user with full user privileges and a project-level API token, which could then be used for subsequent project-level API requests. @@ -2386,7 +2590,6 @@ public async Task ImportMetaDataAsync(string token, Content content, /// /// To use this method, you must have a Super API Token. /// - /// To use this method, you must have a Super API Token. /// /// The Super API Token specific to a user /// csv, json [default], xml @@ -2397,10 +2600,10 @@ public async Task ImportMetaDataAsync(string token, Content content, /// JSON Example: /// [{"project_title":"My New REDCap Project","purpose":"0"}] /// - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// default: NULL - The 'odm' parameter must be an XML string in CDISC ODM XML format that contains project metadata (fields, forms, events, arms) and might optionally contain data to be imported as well. The XML contained in this parameter can come from a REDCap Project XML export file from REDCap itself, or may come from another system that is capable of exporting projects and data in CDISC ODM format. If the 'odm' parameter is included in the API request, it will use the XML to import its contents into the newly created project. This will allow you not only to create the project with the API request, but also to import all fields, forms, and project attributes (and events and arms, if longitudinal) as well as record data all at the same time. /// When a project is created, a 32-character project-level API Token is returned (associated with both the project and user creating the project). This token could then ostensibly be used to make subsequent API calls to this project, such as for adding new events, fields, records, etc. - public async Task CreateProjectAsync(string token, ReturnFormat format, List data, OnErrorFormat onErrorFormat = OnErrorFormat.json, string odm = null) + public async Task CreateProjectAsync(string token, RedcapFormat format, List data, RedcapReturnFormat returnFormat = RedcapReturnFormat.json, string odm = default) { try { @@ -2414,7 +2617,7 @@ public async Task CreateProjectAsync(string token, ReturnFormat forma { "token", token }, { "content", Content.Project.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() }, + { "returnFormat", returnFormat.GetDisplayName() }, { "data", _serializedData } }; if (!IsNullOrEmpty(odm)) @@ -2435,10 +2638,9 @@ public async Task CreateProjectAsync(string token, ReturnFormat forma } /// - /// API Version 1.0.0+ - /// From Redcap Version 6.11.0 + /// From Redcap Version 6.11.0

/// - /// Create A New Project + /// Create A New Project
/// /// This method allows you to create a new REDCap project. A 64-character Super API Token is required for this method (as opposed to project-level API methods that require a regular 32-character token associated with the project-user). In the API request, you must minimally provide the project attributes 'project_title' and 'purpose' (with numerical value 0=Practice/Just for fun, 1=Other, 2=Research, 3=Quality Improvement, 4=Operational Support) when creating a project. /// When a project is created with this method, the project will automatically be given all the project-level defaults just as if you created a new empty project via the web user interface, such as a automatically creating a single data collection instrument seeded with a single Record ID field and Form Status field, as well as (for longitudinal projects) one arm with one event. And if you intend to create your own arms or events immediately after creating the project, it is recommended that you utilize the override=1 parameter in the 'Import Arms' or 'Import Events' method, respectively, so that the default arm and event are removed when you add your own.Also, the user creating the project will automatically be added to the project as a user with full user privileges and a project-level API token, which could then be used for subsequent project-level API requests. @@ -2459,10 +2661,10 @@ public async Task CreateProjectAsync(string token, ReturnFormat forma /// JSON Example: /// [{"project_title":"My New REDCap Project","purpose":"0"}] /// - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// default: NULL - The 'odm' parameter must be an XML string in CDISC ODM XML format that contains project metadata (fields, forms, events, arms) and might optionally contain data to be imported as well. The XML contained in this parameter can come from a REDCap Project XML export file from REDCap itself, or may come from another system that is capable of exporting projects and data in CDISC ODM format. If the 'odm' parameter is included in the API request, it will use the XML to import its contents into the newly created project. This will allow you not only to create the project with the API request, but also to import all fields, forms, and project attributes (and events and arms, if longitudinal) as well as record data all at the same time. /// When a project is created, a 32-character project-level API Token is returned (associated with both the project and user creating the project). This token could then ostensibly be used to make subsequent API calls to this project, such as for adding new events, fields, records, etc. - public async Task CreateProjectAsync(string token, Content content, ReturnFormat format, List data, OnErrorFormat onErrorFormat = OnErrorFormat.json, string odm = null) + public async Task CreateProjectAsync(string token, Content content, RedcapFormat format, List data, RedcapReturnFormat returnFormat = RedcapReturnFormat.json, string odm = null) { try { @@ -2476,7 +2678,7 @@ public async Task CreateProjectAsync(string token, Content content, R { "token", token }, { "content", content.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() }, + { "returnFormat", returnFormat.GetDisplayName() }, { "data", _serializedData } }; if (!IsNullOrEmpty(odm)) @@ -2497,8 +2699,7 @@ public async Task CreateProjectAsync(string token, Content content, R } /// - /// API Version 1.0.0+ - /// Import Project Information + /// Import Project Information

/// This method allows you to update some of the basic attributes of a given REDCap project, such as the project's title, if it is longitudinal, if surveys are enabled, etc. Its data format corresponds to the format in the API method Export Project Information. ///
/// @@ -2512,7 +2713,7 @@ public async Task CreateProjectAsync(string token, Content content, R /// project_title, project_language, purpose, purpose_other, project_notes, custom_record_label, secondary_unique_field, is_longitudinal, surveys_enabled, scheduling_enabled, record_autonumbering_enabled, randomization_enabled, project_irb_number, project_grant_number, project_pi_firstname, project_pi_lastname, display_today_now_button /// /// Returns the number of values accepted to be updated in the project settings (including values which remained the same before and after the import). - public async Task ImportProjectInfoAsync(string token, Content content, ReturnFormat format, RedcapProjectInfo projectInfo) + public async Task ImportProjectInfoAsync(string token, Content content, RedcapFormat format, RedcapProjectInfo projectInfo) { try { @@ -2542,8 +2743,7 @@ public async Task ImportProjectInfoAsync(string token, Content content, } /// - /// API Version 1.0.0+ - /// Import Project Information + /// Import Project Information

/// This method allows you to update some of the basic attributes of a given REDCap project, such as the project's title, if it is longitudinal, if surveys are enabled, etc. Its data format corresponds to the format in the API method Export Project Information. ///
/// @@ -2556,7 +2756,7 @@ public async Task ImportProjectInfoAsync(string token, Content content, /// project_title, project_language, purpose, purpose_other, project_notes, custom_record_label, secondary_unique_field, is_longitudinal, surveys_enabled, scheduling_enabled, record_autonumbering_enabled, randomization_enabled, project_irb_number, project_grant_number, project_pi_firstname, project_pi_lastname, display_today_now_button /// /// Returns the number of values accepted to be updated in the project settings (including values which remained the same before and after the import). - public async Task ImportProjectInfoAsync(string token, ReturnFormat format, RedcapProjectInfo projectInfo) + public async Task ImportProjectInfoAsync(string token, RedcapFormat format, RedcapProjectInfo projectInfo) { try { @@ -2587,8 +2787,7 @@ public async Task ImportProjectInfoAsync(string token, ReturnFormat form } /// - /// API Version 1.0.0+ - /// Export Project Information + /// Export Project Information

/// This method allows you to export some of the basic attributes of a given REDCap project, such as the project's title, if it is longitudinal, if surveys are enabled, the time the project was created and moved to production, etc. ///
/// @@ -2598,12 +2797,12 @@ public async Task ImportProjectInfoAsync(string token, ReturnFormat form /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. /// project /// csv, json [default], xml - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// /// Attributes for the project in the format specified. For any values that are boolean, they will be represented as either a '0' (no/false) or '1' (yes/true). Also, all date/time values will be returned in Y-M-D H:M:S format. The following attributes will be returned: /// project_id, project_title, creation_time, production_time, in_production, project_language, purpose, purpose_other, project_notes, custom_record_label, secondary_unique_field, is_longitudinal, surveys_enabled, scheduling_enabled, record_autonumbering_enabled, randomization_enabled, ddp_enabled, project_irb_number, project_grant_number, project_pi_firstname, project_pi_lastname, display_today_now_button /// - public async Task ExportProjectInfoAsync(string token, Content content = Content.Project, ReturnFormat format = ReturnFormat.json, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportProjectInfoAsync(string token, Content content = Content.Project, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -2617,7 +2816,7 @@ public async Task ExportProjectInfoAsync(string token, Content content = { "token", token }, { "content", content.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; return await this.SendPostRequestAsync(payload, _uri); } @@ -2631,8 +2830,7 @@ public async Task ExportProjectInfoAsync(string token, Content content = } } /// - /// API Version 1.0.0+ - /// Export Project Information + /// Export Project Information

/// This method allows you to export some of the basic attributes of a given REDCap project, such as the project's title, if it is longitudinal, if surveys are enabled, the time the project was created and moved to production, etc. ///
/// @@ -2641,12 +2839,12 @@ public async Task ExportProjectInfoAsync(string token, Content content = /// /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. /// csv, json [default], xml - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// /// Attributes for the project in the format specified. For any values that are boolean, they will be represented as either a '0' (no/false) or '1' (yes/true). Also, all date/time values will be returned in Y-M-D H:M:S format. The following attributes will be returned: /// project_id, project_title, creation_time, production_time, in_production, project_language, purpose, purpose_other, project_notes, custom_record_label, secondary_unique_field, is_longitudinal, surveys_enabled, scheduling_enabled, record_autonumbering_enabled, randomization_enabled, ddp_enabled, project_irb_number, project_grant_number, project_pi_firstname, project_pi_lastname, display_today_now_button /// - public async Task ExportProjectInfoAsync(string token, ReturnFormat format = ReturnFormat.json, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportProjectInfoAsync(string token, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -2660,7 +2858,7 @@ public async Task ExportProjectInfoAsync(string token, ReturnFormat form { "token", token }, { "content", Content.Project.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; return await this.SendPostRequestAsync(payload, _uri); } @@ -2675,10 +2873,9 @@ public async Task ExportProjectInfoAsync(string token, ReturnFormat form } /// - /// API Version 1.0.0+ - /// From Redcap Version 6.12.0 + /// From Redcap Version 6.12.0

/// - /// Export Entire Project as REDCap XML File (containing metadata and data) + /// Export Entire Project as REDCap XML File (containing metadata and data)
/// The entire project(all records, events, arms, instruments, fields, and project attributes) can be downloaded as a single XML file, which is in CDISC ODM format(ODM version 1.3.1). This XML file can be used to create a clone of the project(including its data, optionally) on this REDCap server or on another REDCap server (it can be uploaded on the Create New Project page). Because it is in CDISC ODM format, it can also be used to import the project into another ODM-compatible system. NOTE: All the option paramters listed below ONLY apply to data returned if the 'returnMetadataOnly' parameter is set to FALSE (default). For this API method, ALL metadata (all fields, forms, events, and arms) will always be exported.Only the data returned can be filtered using the optional parameters. /// Note about export rights: If the 'returnMetadataOnly' parameter is set to FALSE, then please be aware that Data Export user rights will be applied to any data returned from this API request. For example, if you have 'De-Identified' or 'Remove all tagged Identifier fields' data export rights, then some data fields *might* be removed and filtered out of the data set returned from the API. To make sure that no data is unnecessarily filtered out of your API request, you should have 'Full Data Set' export rights in the project. ///
@@ -2692,13 +2889,13 @@ public async Task ExportProjectInfoAsync(string token, ReturnFormat form /// an array of record names specifying specific records you wish to pull (by default, all records are pulled) /// an array of field names specifying specific fields you wish to pull (by default, all fields are pulled) /// an array of unique event names that you wish to pull records for - only for longitudinal projects - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// true, false [default] - specifies whether or not to export the survey identifier field (e.g., 'redcap_survey_identifier') or survey timestamp fields (e.g., instrument+'_timestamp') when surveys are utilized in the project. If you do not pass in this flag, it will default to 'false'. If set to 'true', it will return the redcap_survey_identifier field and also the survey timestamp field for a particular survey when at least one field from that survey is being exported. NOTE: If the survey identifier field or survey timestamp fields are imported via API data import, they will simply be ignored since they are not real fields in the project but rather are pseudo-fields. /// true, false [default] - specifies whether or not to export the 'redcap_data_access_group' field when data access groups are utilized in the project. If you do not pass in this flag, it will default to 'false'. NOTE: This flag is only viable if the user whose token is being used to make the API request is *not* in a data access group. If the user is in a group, then this flag will revert to its default value. /// String of logic text (e.g., [age] > 30) for filtering the data to be returned by this API method, in which the API will only return the records (or record-events, if a longitudinal project) where the logic evaluates as TRUE. This parameter is blank/null by default unless a value is supplied. Please note that if the filter logic contains any incorrect syntax, the API will respond with an error message. /// true, false [default] - TRUE will cause the XML returned to include all files uploaded for File Upload and Signature fields for all records in the project, whereas FALSE will cause all such fields not to be included. NOTE: Setting this option to TRUE can make the export very large and may prevent it from completing if the project contains many files or very large files. /// The entire REDCap project's metadata (and data, if specified) will be returned in CDISC ODM format as a single XML string. - public async Task ExportProjectXmlAsync(string token, Content content, bool returnMetadataOnly = false, string[] records = null, string[] fields = null, string[] events = null, OnErrorFormat onErrorFormat = OnErrorFormat.json, bool exportSurveyFields = false, bool exportDataAccessGroups = false, string filterLogic = null, bool exportFiles = false) + public async Task ExportProjectXmlAsync(string token, Content content, bool returnMetadataOnly = false, string[] records = default, string[] fields = default, string[] events = default, RedcapReturnFormat returnFormat = RedcapReturnFormat.json, bool exportSurveyFields = false, bool exportDataAccessGroups = false, string filterLogic = default, bool exportFiles = false) { try { @@ -2711,7 +2908,7 @@ public async Task ExportProjectXmlAsync(string token, Content content, b { { "token", token }, { "content", content.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; // Optional if (returnMetadataOnly) @@ -2755,10 +2952,9 @@ public async Task ExportProjectXmlAsync(string token, Content content, b } /// - /// API Version 1.0.0+ - /// From Redcap Version 6.12.0 + /// From Redcap Version 6.12.0
/// - /// Export Entire Project as REDCap XML File (containing metadata and data) + /// Export Entire Project as REDCap XML File (containing metadata and data)
/// The entire project(all records, events, arms, instruments, fields, and project attributes) can be downloaded as a single XML file, which is in CDISC ODM format(ODM version 1.3.1). This XML file can be used to create a clone of the project(including its data, optionally) on this REDCap server or on another REDCap server (it can be uploaded on the Create New Project page). Because it is in CDISC ODM format, it can also be used to import the project into another ODM-compatible system. NOTE: All the option paramters listed below ONLY apply to data returned if the 'returnMetadataOnly' parameter is set to FALSE (default). For this API method, ALL metadata (all fields, forms, events, and arms) will always be exported.Only the data returned can be filtered using the optional parameters. /// Note about export rights: If the 'returnMetadataOnly' parameter is set to FALSE, then please be aware that Data Export user rights will be applied to any data returned from this API request. For example, if you have 'De-Identified' or 'Remove all tagged Identifier fields' data export rights, then some data fields *might* be removed and filtered out of the data set returned from the API. To make sure that no data is unnecessarily filtered out of your API request, you should have 'Full Data Set' export rights in the project. ///
@@ -2771,13 +2967,13 @@ public async Task ExportProjectXmlAsync(string token, Content content, b /// an array of record names specifying specific records you wish to pull (by default, all records are pulled) /// an array of field names specifying specific fields you wish to pull (by default, all fields are pulled) /// an array of unique event names that you wish to pull records for - only for longitudinal projects - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// true, false [default] - specifies whether or not to export the survey identifier field (e.g., 'redcap_survey_identifier') or survey timestamp fields (e.g., instrument+'_timestamp') when surveys are utilized in the project. If you do not pass in this flag, it will default to 'false'. If set to 'true', it will return the redcap_survey_identifier field and also the survey timestamp field for a particular survey when at least one field from that survey is being exported. NOTE: If the survey identifier field or survey timestamp fields are imported via API data import, they will simply be ignored since they are not real fields in the project but rather are pseudo-fields. /// true, false [default] - specifies whether or not to export the 'redcap_data_access_group' field when data access groups are utilized in the project. If you do not pass in this flag, it will default to 'false'. NOTE: This flag is only viable if the user whose token is being used to make the API request is *not* in a data access group. If the user is in a group, then this flag will revert to its default value. /// String of logic text (e.g., [age] > 30) for filtering the data to be returned by this API method, in which the API will only return the records (or record-events, if a longitudinal project) where the logic evaluates as TRUE. This parameter is blank/null by default unless a value is supplied. Please note that if the filter logic contains any incorrect syntax, the API will respond with an error message. /// true, false [default] - TRUE will cause the XML returned to include all files uploaded for File Upload and Signature fields for all records in the project, whereas FALSE will cause all such fields not to be included. NOTE: Setting this option to TRUE can make the export very large and may prevent it from completing if the project contains many files or very large files. /// The entire REDCap project's metadata (and data, if specified) will be returned in CDISC ODM format as a single XML string. - public async Task ExportProjectXmlAsync(string token, bool returnMetadataOnly = false, string[] records = null, string[] fields = null, string[] events = null, OnErrorFormat onErrorFormat = OnErrorFormat.json, bool exportSurveyFields = false, bool exportDataAccessGroups = false, string filterLogic = null, bool exportFiles = false) + public async Task ExportProjectXmlAsync(string token, bool returnMetadataOnly = false, string[] records = default, string[] fields = default, string[] events = default, RedcapReturnFormat returnFormat = RedcapReturnFormat.json, bool exportSurveyFields = false, bool exportDataAccessGroups = false, string filterLogic = default, bool exportFiles = false) { try { @@ -2790,7 +2986,7 @@ public async Task ExportProjectXmlAsync(string token, bool returnMetadat { { "token", token }, { "content", Content.ProjectXml.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; // Optional if (returnMetadataOnly) @@ -2836,9 +3032,8 @@ public async Task ExportProjectXmlAsync(string token, bool returnMetadat #endregion Projects #region Records /// - /// API Version 1.0.0+ - /// From Redcap Version 6.18.0 - /// Generate Next Record Name + /// From Redcap Version 6.18.0
+ /// Generate Next Record Name
/// To be used by projects with record auto-numbering enabled, this method exports the next potential record ID for a project. It generates the next record name by determining the current maximum numerical record ID and then incrementing it by one. /// Note: This method does not create a new record, but merely determines what the next record name would be. /// If using Data Access Groups (DAGs) in the project, this method accounts for the special formatting of the record name for users in DAGs (e.g., DAG-ID); in this case, it only assigns the next value for ID for all numbers inside a DAG. For example, if a DAG has a corresponding DAG number of 223 wherein records 223-1 and 223-2 already exist, then the next record will be 223-3 if the API user belongs to the DAG that has DAG number 223. (The DAG number is auto-assigned by REDCap for each DAG when the DAG is first created.) When generating a new record name in a DAG, the method considers all records in the entire project when determining the maximum record ID, including those that might have been originally created in that DAG but then later reassigned to another DAG. @@ -2876,9 +3071,8 @@ public async Task GenerateNextRecordNameAsync(string token) } /// - /// API Version 1.0.0+ - /// From Redcap Version 6.18.0 - /// Generate Next Record Name + /// From Redcap Version 6.18.0
+ /// Generate Next Record Name
/// To be used by projects with record auto-numbering enabled, this method exports the next potential record ID for a project. It generates the next record name by determining the current maximum numerical record ID and then incrementing it by one. /// Note: This method does not create a new record, but merely determines what the next record name would be. /// If using Data Access Groups (DAGs) in the project, this method accounts for the special formatting of the record name for users in DAGs (e.g., DAG-ID); in this case, it only assigns the next value for ID for all numbers inside a DAG. For example, if a DAG has a corresponding DAG number of 223 wherein records 223-1 and 223-2 already exist, then the next record will be 223-3 if the API user belongs to the DAG that has DAG number 223. (The DAG number is auto-assigned by REDCap for each DAG when the DAG is first created.) When generating a new record name in a DAG, the method considers all records in the entire project when determining the maximum record ID, including those that might have been originally created in that DAG but then later reassigned to another DAG. @@ -2917,9 +3111,8 @@ public async Task GenerateNextRecordNameAsync(string token, Content cont } /// - /// API Version 1.0.0+ - /// From Redcap Version 11.4.0 - /// Export Records + /// From Redcap Version 11.4.0
+ /// Export Records
/// This method allows you to export a set of records for a project. /// Note about export rights: Please be aware that Data Export user rights will be applied to this API request.For example, if you have 'No Access' data export rights in the project, then the API data export will fail and return an error. And if you have 'De-Identified' or 'Remove all tagged Identifier fields' data export rights, then some data fields *might* be removed and filtered out of the data set returned from the API. To make sure that no data is unnecessarily filtered out of your API request, you should have 'Full Data Set' export rights in the project. ///
@@ -2936,7 +3129,7 @@ public async Task GenerateNextRecordNameAsync(string token, Content cont /// raw [default], label - export the raw coded values or labels for the options of multiple choice fields /// raw [default], label - (for 'csv' format 'flat' type only) for the CSV headers, export the variable/field names (raw) or the field labels (label) /// true, false [default] - specifies the format of checkbox field values specifically when exporting the data as labels (i.e., when rawOrLabel=label) in flat format (i.e., when type=flat). When exporting labels, by default (without providing the exportCheckboxLabel flag or if exportCheckboxLabel=false), all checkboxes will either have a value 'Checked' if they are checked or 'Unchecked' if not checked. But if exportCheckboxLabel is set to true, it will instead export the checkbox value as the checkbox option's label (e.g., 'Choice 1') if checked or it will be blank/empty (no value) if not checked. If rawOrLabel=false or if type=eav, then the exportCheckboxLabel flag is ignored. (The exportCheckboxLabel parameter is ignored for type=eav because 'eav' type always exports checkboxes differently anyway, in which checkboxes are exported with their true variable name (whereas the 'flat' type exports them as variable___code format), and another difference is that 'eav' type *always* exports checkbox values as the choice label for labels export, or as 0 or 1 (if unchecked or checked, respectively) for raw export.) - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// true, false [default] - specifies whether or not to export the survey identifier field (e.g., 'redcap_survey_identifier') or survey timestamp fields (e.g., instrument+'_timestamp') when surveys are utilized in the project. If you do not pass in this flag, it will default to 'false'. If set to 'true', it will return the redcap_survey_identifier field and also the survey timestamp field for a particular survey when at least one field from that survey is being exported. NOTE: If the survey identifier field or survey timestamp fields are imported via API data import, they will simply be ignored since they are not real fields in the project but rather are pseudo-fields. /// true, false [default] - specifies whether or not to export the 'redcap_data_access_group' field when data access groups are utilized in the project. If you do not pass in this flag, it will default to 'false'. NOTE: This flag is only viable if the user whose token is being used to make the API request is *not* in a data access group. If the user is in a group, then this flag will revert to its default value. /// String of logic text (e.g., [age] > 30) for filtering the data to be returned by this API method, in which the API will only return the records (or record-events, if a longitudinal project) where the logic evaluates as TRUE. This parameter is blank/null by default unless a value is supplied. Please note that if the filter logic contains any incorrect syntax, the API will respond with an error message. @@ -2946,7 +3139,7 @@ public async Task GenerateNextRecordNameAsync(string token, Content cont /// If specified, force all numbers into same decimal format. You may choose to force all data values containing a decimal to have the same decimal character, which will be applied to all calc fields and number-validated text fields. Options include comma ',' or dot/full stop '.', but if left blank/null, then it will export numbers using the fields' native decimal format. Simply provide the value of either ',' or '.' for this parameter. /// true, false [default] - specifies whether or not to export blank values for instrument complete status fields that have a gray status icon. All instrument complete status fields having a gray icon can be exported either as a blank value or as "0" (Incomplete). Blank values are recommended in a data export if the data will be re-imported into a REDCap project. /// Data from the project in the format and type specified ordered by the record (primary key of project) and then by event id - public async Task ExportRecordsAsync(string token, RedcapFormat format = RedcapFormat.json, RedcapDataType redcapDataType = RedcapDataType.flat, string[] records = null, string[] fields = null, string[] forms = null, string[] events = null, RawOrLabel rawOrLabel = RawOrLabel.raw, RawOrLabelHeaders rawOrLabelHeaders = RawOrLabelHeaders.raw, bool exportCheckboxLabel = false, OnErrorFormat onErrorFormat = OnErrorFormat.json, bool exportSurveyFields = false, bool exportDataAccessGroups = false, string filterLogic = null, DateTime? dateRangeBegin = null, DateTime? dateRangeEnd = null, string csvDelimiter = null, string decimalCharacter = null, bool exportBlankForGrayFormStatus = false) + public async Task ExportRecordsAsync(string token, RedcapFormat format = RedcapFormat.json, RedcapDataType redcapDataType = RedcapDataType.flat, string[] records = default, string[] fields = default, string[] forms = default, string[] events = default, RawOrLabel rawOrLabel = RawOrLabel.raw, RawOrLabelHeaders rawOrLabelHeaders = RawOrLabelHeaders.raw, bool exportCheckboxLabel = false, RedcapReturnFormat returnFormat = RedcapReturnFormat.json, bool exportSurveyFields = false, bool exportDataAccessGroups = false, string filterLogic = null, DateTime? dateRangeBegin = default, DateTime? dateRangeEnd = default, string csvDelimiter = default, string decimalCharacter = default, bool exportBlankForGrayFormStatus = false) { try { @@ -2957,7 +3150,7 @@ public async Task ExportRecordsAsync(string token, RedcapFormat format = { "token", token }, { "content", Content.Record.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() }, + { "returnFormat", returnFormat.GetDisplayName() }, { "type", redcapDataType.GetDisplayName() }, {"exportBlankForGrayFormStatus", exportBlankForGrayFormStatus.ToString() } @@ -3039,9 +3232,8 @@ public async Task ExportRecordsAsync(string token, RedcapFormat format = } /// - /// API Version 1.0.0+ - /// From Redcap Version 11.4.0 - /// Export Records + /// From Redcap Version 11.4.0
+ /// Export Records
/// This method allows you to export a set of records for a project. /// Note about export rights: Please be aware that Data Export user rights will be applied to this API request.For example, if you have 'No Access' data export rights in the project, then the API data export will fail and return an error. And if you have 'De-Identified' or 'Remove all tagged Identifier fields' data export rights, then some data fields *might* be removed and filtered out of the data set returned from the API. To make sure that no data is unnecessarily filtered out of your API request, you should have 'Full Data Set' export rights in the project. ///
@@ -3059,7 +3251,7 @@ public async Task ExportRecordsAsync(string token, RedcapFormat format = /// raw [default], label - export the raw coded values or labels for the options of multiple choice fields /// raw [default], label - (for 'csv' format 'flat' type only) for the CSV headers, export the variable/field names (raw) or the field labels (label) /// true, false [default] - specifies the format of checkbox field values specifically when exporting the data as labels (i.e., when rawOrLabel=label) in flat format (i.e., when type=flat). When exporting labels, by default (without providing the exportCheckboxLabel flag or if exportCheckboxLabel=false), all checkboxes will either have a value 'Checked' if they are checked or 'Unchecked' if not checked. But if exportCheckboxLabel is set to true, it will instead export the checkbox value as the checkbox option's label (e.g., 'Choice 1') if checked or it will be blank/empty (no value) if not checked. If rawOrLabel=false or if type=eav, then the exportCheckboxLabel flag is ignored. (The exportCheckboxLabel parameter is ignored for type=eav because 'eav' type always exports checkboxes differently anyway, in which checkboxes are exported with their true variable name (whereas the 'flat' type exports them as variable___code format), and another difference is that 'eav' type *always* exports checkbox values as the choice label for labels export, or as 0 or 1 (if unchecked or checked, respectively) for raw export.) - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// true, false [default] - specifies whether or not to export the survey identifier field (e.g., 'redcap_survey_identifier') or survey timestamp fields (e.g., instrument+'_timestamp') when surveys are utilized in the project. If you do not pass in this flag, it will default to 'false'. If set to 'true', it will return the redcap_survey_identifier field and also the survey timestamp field for a particular survey when at least one field from that survey is being exported. NOTE: If the survey identifier field or survey timestamp fields are imported via API data import, they will simply be ignored since they are not real fields in the project but rather are pseudo-fields. /// true, false [default] - specifies whether or not to export the 'redcap_data_access_group' field when data access groups are utilized in the project. If you do not pass in this flag, it will default to 'false'. NOTE: This flag is only viable if the user whose token is being used to make the API request is *not* in a data access group. If the user is in a group, then this flag will revert to its default value. /// String of logic text (e.g., [age] > 30) for filtering the data to be returned by this API method, in which the API will only return the records (or record-events, if a longitudinal project) where the logic evaluates as TRUE. This parameter is blank/null by default unless a value is supplied. Please note that if the filter logic contains any incorrect syntax, the API will respond with an error message. @@ -3069,7 +3261,7 @@ public async Task ExportRecordsAsync(string token, RedcapFormat format = /// If specified, force all numbers into same decimal format. You may choose to force all data values containing a decimal to have the same decimal character, which will be applied to all calc fields and number-validated text fields. Options include comma ',' or dot/full stop '.', but if left blank/null, then it will export numbers using the fields' native decimal format. Simply provide the value of either ',' or '.' for this parameter. /// true, false [default] - specifies whether or not to export blank values for instrument complete status fields that have a gray status icon. All instrument complete status fields having a gray icon can be exported either as a blank value or as "0" (Incomplete). Blank values are recommended in a data export if the data will be re-imported into a REDCap project. /// Data from the project in the format and type specified ordered by the record (primary key of project) and then by event id - public async Task ExportRecordsAsync(string token, Content content, RedcapFormat format = RedcapFormat.json, RedcapDataType redcapDataType = RedcapDataType.flat, string[] records = null, string[] fields = null, string[] forms = null, string[] events = null, RawOrLabel rawOrLabel = RawOrLabel.raw, RawOrLabelHeaders rawOrLabelHeaders = RawOrLabelHeaders.raw, bool exportCheckboxLabel = false, OnErrorFormat onErrorFormat = OnErrorFormat.json, bool exportSurveyFields = false, bool exportDataAccessGroups = false, string filterLogic = null, DateTime? dateRangeBegin = null, DateTime? dateRangeEnd = null, string csvDelimiter = ",", string decimalCharacter = ".", bool exportBlankForGrayFormStatus = false) + public async Task ExportRecordsAsync(string token, Content content, RedcapFormat format = RedcapFormat.json, RedcapDataType redcapDataType = RedcapDataType.flat, string[] records = null, string[] fields = null, string[] forms = null, string[] events = null, RawOrLabel rawOrLabel = RawOrLabel.raw, RawOrLabelHeaders rawOrLabelHeaders = RawOrLabelHeaders.raw, bool exportCheckboxLabel = false, RedcapReturnFormat returnFormat = RedcapReturnFormat.json, bool exportSurveyFields = false, bool exportDataAccessGroups = false, string filterLogic = null, DateTime? dateRangeBegin = null, DateTime? dateRangeEnd = null, string csvDelimiter = ",", string decimalCharacter = ".", bool exportBlankForGrayFormStatus = false) { try { @@ -3080,7 +3272,7 @@ public async Task ExportRecordsAsync(string token, Content content, Redc { "token", token }, { "content", content.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() }, + { "returnFormat", returnFormat.GetDisplayName() }, { "type", redcapDataType.GetDisplayName() }, {"exportBlankForGrayFormStatus", exportBlankForGrayFormStatus.ToString() } }; @@ -3161,9 +3353,8 @@ public async Task ExportRecordsAsync(string token, Content content, Redc } /// - /// API Version 1.0.0++ - /// From Redcap Version 11.4.0 - /// Export Record + /// From Redcap Version 11.4.0
+ /// Export Record
/// This method allows you to export a single record for a project. /// Note about export rights: Please be aware that Data Export user rights will be applied to this API request.For example, if you have 'No Access' data export rights in the project, then the API data export will fail and return an error. And if you have 'De-Identified' or 'Remove all tagged Identifier fields' data export rights, then some data fields *might* be removed and filtered out of the data set returned from the API. To make sure that no data is unnecessarily filtered out of your API request, you should have 'Full Data Set' export rights in the project. ///
@@ -3187,7 +3378,7 @@ public async Task ExportRecordsAsync(string token, Content content, Redc /// String of logic text (e.g., [age] > 30) for filtering the data to be returned by this API method, in which the API will only return the records (or record-events, if a longitudinal project) where the logic evaluates as TRUE. This parameter is blank/null by default unless a value is supplied. Please note that if the filter logic contains any incorrect syntax, the API will respond with an error message. /// true, false [default] - specifies whether or not to export blank values for instrument complete status fields that have a gray status icon. All instrument complete status fields having a gray icon can be exported either as a blank value or as "0" (Incomplete). Blank values are recommended in a data export if the data will be re-imported into a REDCap project. /// Data from the project in the format and type specified ordered by the record (primary key of project) and then by event id - public async Task ExportRecordAsync(string token, Content content, string record, ReturnFormat format = ReturnFormat.json, RedcapDataType redcapDataType = RedcapDataType.flat, string[] fields = null, string[] forms = null, string[] events = null, RawOrLabel rawOrLabel = RawOrLabel.raw, RawOrLabelHeaders rawOrLabelHeaders = RawOrLabelHeaders.raw, bool exportCheckboxLabel = false, OnErrorFormat onErrorFormat = OnErrorFormat.json, bool exportSurveyFields = false, bool exportDataAccessGroups = false, string filterLogic = null, bool exportBlankForGrayFormStatus = false) + public async Task ExportRecordAsync(string token, Content content, string record, RedcapFormat format = RedcapFormat.json, RedcapDataType redcapDataType = RedcapDataType.flat, string[] fields = null, string[] forms = null, string[] events = null, RawOrLabel rawOrLabel = RawOrLabel.raw, RawOrLabelHeaders rawOrLabelHeaders = RawOrLabelHeaders.raw, bool exportCheckboxLabel = false, RedcapReturnFormat onErrorFormat = RedcapReturnFormat.json, bool exportSurveyFields = false, bool exportDataAccessGroups = false, string filterLogic = null, bool exportBlankForGrayFormStatus = false) { try { @@ -3265,9 +3456,8 @@ public async Task ExportRecordAsync(string token, Content content, strin /// - /// API Version 1.0.0+ - /// Updated with version 10.3.0 improvements - /// Import Records + /// From Redcap version with version 10.3.0
+ /// Import Records
/// This method allows you to import a set of records for a project ///
/// @@ -3294,9 +3484,9 @@ public async Task ExportRecordAsync(string token, Content content, strin /// MDY, DMY, YMD [default] - the format of values being imported for dates or datetime fields (understood with M representing 'month', D as 'day', and Y as 'year') - NOTE: The default format is Y-M-D (with dashes), while MDY and DMY values should always be formatted as M/D/Y or D/M/Y (with slashes), respectively. /// Set the delimiter used to separate values in the CSV data file (for CSV format only). Options include: comma ',' (default), 'tab', semi-colon ';', pipe '|', or caret '^'. Simply provide the value in quotes for this parameter. /// count [default] - the number of records imported, ids - a list of all record IDs that were imported, auto_ids = (used only when forceAutoNumber=true) a list of pairs of all record IDs that were imported, includes the new ID created and the ID value that was sent in the API request (e.g., 323,10). - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// the content specified by returnContent - public async Task ImportRecordsAsync(string token, ReturnFormat format, RedcapDataType redcapDataType, OverwriteBehavior overwriteBehavior, bool forceAutoNumber, List data, string dateFormat = "", CsvDelimiter csvDelimiter = CsvDelimiter.tab, ReturnContent returnContent = ReturnContent.count, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ImportRecordsAsync(string token, RedcapFormat format, RedcapDataType redcapDataType, OverwriteBehavior overwriteBehavior, bool forceAutoNumber, List data, string dateFormat = default, CsvDelimiter csvDelimiter = CsvDelimiter.tab, ReturnContent returnContent = ReturnContent.count, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -3313,7 +3503,7 @@ public async Task ImportRecordsAsync(string token, ReturnFormat forma { "forceAutoNumber", forceAutoNumber.ToString() }, { "csvDelimiter", csvDelimiter.ToString() }, { "data", _serializedData }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; // Optional if (!IsNullOrEmpty(dateFormat)) @@ -3337,9 +3527,8 @@ public async Task ImportRecordsAsync(string token, ReturnFormat forma } /// - /// API Version 1.0.0+ - /// Updated with version 10.3.0 improvements - /// Import Records + /// From Redcap Version 10.3.0
+ /// Import Records
/// This method allows you to import a set of records for a project ///
/// @@ -3365,9 +3554,9 @@ public async Task ImportRecordsAsync(string token, ReturnFormat forma /// MDY, DMY, YMD [default] - the format of values being imported for dates or datetime fields (understood with M representing 'month', D as 'day', and Y as 'year') - NOTE: The default format is Y-M-D (with dashes), while MDY and DMY values should always be formatted as M/D/Y or D/M/Y (with slashes), respectively. /// Set the delimiter used to separate values in the CSV data file (for CSV format only). Options include: comma ',' (default), 'tab', semi-colon ';', pipe '|', or caret '^'. Simply provide the value in quotes for this parameter. /// count [default] - the number of records imported, ids - a list of all record IDs that were imported, auto_ids = (used only when forceAutoNumber=true) a list of pairs of all record IDs that were imported, includes the new ID created and the ID value that was sent in the API request (e.g., 323,10). - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// the content specified by returnContent - public async Task ImportRecordsAsync(string token, Content content, ReturnFormat format, RedcapDataType redcapDataType, OverwriteBehavior overwriteBehavior, bool forceAutoNumber, List data, string dateFormat = "", CsvDelimiter csvDelimiter = CsvDelimiter.tab, ReturnContent returnContent = ReturnContent.count, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ImportRecordsAsync(string token, Content content, RedcapFormat format, RedcapDataType redcapDataType, OverwriteBehavior overwriteBehavior, bool forceAutoNumber, List data, string dateFormat = "", CsvDelimiter csvDelimiter = CsvDelimiter.tab, ReturnContent returnContent = ReturnContent.count, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { var importRecordsResults = string.Empty; try @@ -3385,7 +3574,7 @@ public async Task ImportRecordsAsync(string token, Content content, R { "forceAutoNumber", forceAutoNumber.ToString() }, { "csvDelimiter", csvDelimiter.ToString() }, { "data", _serializedData }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; // Optional if (!IsNullOrEmpty(dateFormat)) @@ -3407,8 +3596,7 @@ public async Task ImportRecordsAsync(string token, Content content, R } /// - /// API Version 1.0.0+ - /// Delete Records + /// Delete Records
/// This method allows you to delete one or more records from a project in a single API request. ///
/// @@ -3419,7 +3607,7 @@ public async Task ImportRecordsAsync(string token, Content content, R /// an array of record names specifying specific records you wish to delete /// the arm number of the arm in which the record(s) should be deleted. /// (This can only be used if the project is longitudinal with more than one arm.) NOTE: If the arm parameter is not provided, the specified records will be deleted from all arms in which they exist. Whereas, if arm is provided, they will only be deleted from the specified arm. - /// the number of records deleted. + /// the number of records deleted or (if instrument, event, and/or instance are provided) the number of items deleted over the total records specified. public async Task DeleteRecordsAsync(string token, string[] records, int? arm) { try @@ -3431,6 +3619,10 @@ public async Task DeleteRecordsAsync(string token, string[] records, int { throw new ArgumentNullException("Please provide a valid Redcap token."); } + if (records?.Length < 1) + { + throw new ArgumentNullException("Please provide the records you would like to remove."); + } var payload = new Dictionary { { "token", token }, @@ -3438,7 +3630,6 @@ public async Task DeleteRecordsAsync(string token, string[] records, int { "action", RedcapAction.Delete.GetDisplayName() } }; // Required - //payload.Add("records", await this.ConvertArraytoString(records)); for (var i = 0; i < records.Length; i++) { payload.Add($"records[{i}]", records[i]); @@ -3447,6 +3638,7 @@ public async Task DeleteRecordsAsync(string token, string[] records, int // Optional payload.Add("arm", arm?.ToString()); + return await this.SendPostRequestAsync(payload, _uri); } catch (Exception Ex) @@ -3460,8 +3652,7 @@ public async Task DeleteRecordsAsync(string token, string[] records, int } /// - /// API Version 1.0.0+ - /// Delete Records + /// Delete Records
/// This method allows you to delete one or more records from a project in a single API request. ///
/// @@ -3474,7 +3665,7 @@ public async Task DeleteRecordsAsync(string token, string[] records, int /// an array of record names specifying specific records you wish to delete /// the arm number of the arm in which the record(s) should be deleted. /// (This can only be used if the project is longitudinal with more than one arm.) NOTE: If the arm parameter is not provided, the specified records will be deleted from all arms in which they exist. Whereas, if arm is provided, they will only be deleted from the specified arm. - /// the number of records deleted. + /// the number of records deleted or (if instrument, event, and/or instance are provided) the number of items deleted over the total records specified. public async Task DeleteRecordsAsync(string token, Content content, RedcapAction action, string[] records, int? arm) { try @@ -3486,6 +3677,10 @@ public async Task DeleteRecordsAsync(string token, Content content, Redc { throw new ArgumentNullException("Please provide a valid Redcap token."); } + if (records?.Length < 1) + { + throw new ArgumentNullException("Please provide the records you would like to remove."); + } var payload = new Dictionary { { "token", token }, @@ -3502,6 +3697,7 @@ public async Task DeleteRecordsAsync(string token, Content content, Redc // Optional payload.Add("arm", arm?.ToString()); + return await this.SendPostRequestAsync(payload, _uri); } catch (Exception Ex) @@ -3515,9 +3711,9 @@ public async Task DeleteRecordsAsync(string token, Content content, Redc } /// - /// From Redcap Version 11.3.0 + /// From Redcap Version 11.3.0
/// - /// Delete Records + /// Delete Records
/// This method allows you to delete one or more records from a project in a single API request, and also optionally allows you to delete parts of a record, such as a single instrument's data for one or more records or a single event's data for one or more records. ///
/// @@ -3544,6 +3740,10 @@ public async Task DeleteRecordsAsync(string token, Content content, Redc { throw new ArgumentNullException("Please provide a valid Redcap token."); } + if (records?.Length < 1) + { + throw new ArgumentNullException("Please provide the records you would like to remove."); + } var payload = new Dictionary { { "token", token }, @@ -3575,23 +3775,23 @@ public async Task DeleteRecordsAsync(string token, Content content, Redc } /// - /// From Redcap Version 11.3.3 + /// From Redcap Version 11.3.3
/// - /// Rename Record + /// Rename Record
/// This method allows you to rename a record from a project in a single API request. /// ///
/// /// To use this method, you must have 'Rename Record' user privileges in the project. /// - /// - /// - /// - /// - /// - /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// record + /// rename + /// record name of the current record which you want to rename to new name. + /// new record name to which you want to rename current record. + /// specific arm number in which current record exists. If null, then all records with same name across all arms on which it exists (if longitudinal with multiple arms) will be renamed to new record name, otherwise it will rename the record only in the specified arm. /// Returns "1" if record is renamed or error message if any. - public async Task RenameRecordAsync(string token, string record, string newRecordName, Content content, RedcapAction action, int? arm) + public async Task RenameRecordAsync(string token, Content content, RedcapAction action, string record, string newRecordName, int? arm) { try { @@ -3627,17 +3827,16 @@ public async Task RenameRecordAsync(string token, string record, string #region Repeating Instruments and Events /// - /// API Version 1.0.0+ - /// From Redcap Version 8.2.0 + /// From Redcap Version 8.2.0
/// - /// Export Repeating Instruments and Events + /// Export Repeating Instruments and Events
/// /// This method allows you to export a list of the repeated instruments and repeating events for a project. This includes their unique instrument name as seen in the second column of the Data Dictionary, as well as each repeating instrument's corresponding custom repeating instrument label. For longitudinal projects, the unique event name is also returned for each repeating instrument. Additionally, repeating events are returned as separate items, in which the instrument name will be blank/null to indicate that it is a repeating event (rather than a repeating instrument). ///
/// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. /// csv, json [default], xml odm ('odm' refers to CDISC ODM XML format, specifically ODM version 1.3.1) /// Repeated instruments and events for the project in the format specified and will be ordered according to their order in the project. - public async Task ExportRepeatingInstrumentsAndEvents(string token, ReturnFormat format = ReturnFormat.json) + public async Task ExportRepeatingInstrumentsAndEvents(string token, RedcapFormat format = RedcapFormat.json) { try { @@ -3664,10 +3863,9 @@ public async Task ExportRepeatingInstrumentsAndEvents(string token, Retu } /// - /// API Version 1.0.0+ - /// From Redcap Version 8.2.0 + /// From Redcap Version 8.2.0
/// - /// Export Repeating Instruments and Events + /// Export Repeating Instruments and Events
/// /// This method allows you to export a list of the repeated instruments and repeating events for a project. This includes their unique instrument name as seen in the second column of the Data Dictionary, as well as each repeating instrument's corresponding custom repeating instrument label. For longitudinal projects, the unique event name is also returned for each repeating instrument. Additionally, repeating events are returned as separate items, in which the instrument name will be blank/null to indicate that it is a repeating event (rather than a repeating instrument). ///
@@ -3675,7 +3873,7 @@ public async Task ExportRepeatingInstrumentsAndEvents(string token, Retu /// repeatingFormsEvents /// csv, json [default], xml odm ('odm' refers to CDISC ODM XML format, specifically ODM version 1.3.1) /// Repeated instruments and events for the project in the format specified and will be ordered according to their order in the project. - public async Task ExportRepeatingInstrumentsAndEvents(string token, Content content, ReturnFormat format = ReturnFormat.json) + public async Task ExportRepeatingInstrumentsAndEvents(string token, Content content, RedcapFormat format = RedcapFormat.json) { try { @@ -3701,19 +3899,18 @@ public async Task ExportRepeatingInstrumentsAndEvents(string token, Cont } } /// - /// API Version 1.0.0+ - /// From Redcap Version 8.10.0 + /// From Redcap Version 8.10.0
/// - /// Import Repeating Instruments and Events + /// Import Repeating Instruments and Events
/// This method allows you to import a list of the repeated instruments and repeating events for a project. This includes their unique instrument name as seen in the second column of the Data Dictionary, as well as each repeating instrument's corresponding custom repeating instrument label. For longitudinal projects, the unique event name is also needed for each repeating instrument. Additionally, repeating events must be submitted as separate items, in which the instrument name will be blank/null to indicate that it is a repeating event (rather than a repeating instrument). ///
/// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. /// Note: Super API Tokens can also be utilized for this method instead of a project-level API token. Users can only be granted a super token by a REDCap administrator (using the API Tokens page in the REDCap Control Center). /// repeatingFormsEvents /// csv, json [default], xml - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Repeated instruments and events for the project in the format specified and will be ordered according to their order in the project. - public async Task ImportRepeatingInstrumentsAndEvents(string token, List data, Content content = Content.RepeatingFormsEvents, ReturnFormat format = ReturnFormat.json, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ImportRepeatingInstrumentsAndEvents(string token, List data, Content content = Content.RepeatingFormsEvents, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -3729,7 +3926,7 @@ public async Task ImportRepeatingInstrumentsAndEvents(string token, L { "token", token }, { "content", content.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() }, + { "returnFormat", returnFormat.GetDisplayName() }, { "data", _serializedData } }; return await this.SendPostRequestAsync(payload, _uri); @@ -3747,8 +3944,7 @@ public async Task ImportRepeatingInstrumentsAndEvents(string token, L #endregion Repeating Instruments and Events #region Reports /// - /// API Version 1.0.0+ - /// Export Reports + /// Export Reports
/// This method allows you to export the data set of a report created on a project's 'Data Exports, Reports, and Stats' page. /// Note about export rights: Please be aware that Data Export user rights will be applied to this API request.For example, if you have 'No Access' data export rights in the project, then the API report export will fail and return an error. And if you have 'De-Identified' or 'Remove all tagged Identifier fields' data export rights, then some data fields *might* be removed and filtered out of the data set returned from the API. To make sure that no data is unnecessarily filtered out of your API request, you should have 'Full Data Set' export rights in the project. /// Also, please note the the 'Export Reports' method does *not* make use of the 'type' (flat/eav) parameter, which can be used in the 'Export Records' method.All data for the 'Export Reports' method is thus exported in flat format.If the 'type' parameter is supplied in the API request, it will be ignored. @@ -3759,12 +3955,14 @@ public async Task ImportRepeatingInstrumentsAndEvents(string token, L /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. /// the report ID number provided next to the report name on the report list page /// csv, json [default], xml odm ('odm' refers to CDISC ODM XML format, specifically ODM version 1.3.1) - /// csv, json [default], xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json [default], xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// raw [default], label - export the raw coded values or labels for the options of multiple choice fields /// raw [default], label - (for 'csv' format 'flat' type only) for the CSV headers, export the variable/field names (raw) or the field labels (label) /// true, false [default] - specifies the format of checkbox field values specifically when exporting the data as labels (i.e., when rawOrLabel=label). When exporting labels, by default (without providing the exportCheckboxLabel flag or if exportCheckboxLabel=false), all checkboxes will either have a value 'Checked' if they are checked or 'Unchecked' if not checked. But if exportCheckboxLabel is set to true, it will instead export the checkbox value as the checkbox option's label (e.g., 'Choice 1') if checked or it will be blank/empty (no value) if not checked. If rawOrLabel=false, then the exportCheckboxLabel flag is ignored. + /// + /// /// Data from the project in the format and type specified ordered by the record (primary key of project) and then by event id - public async Task ExportReportsAsync(string token, int reportId, ReturnFormat format = ReturnFormat.json, OnErrorFormat onErrorFormat = OnErrorFormat.json, RawOrLabel rawOrLabel = RawOrLabel.raw, RawOrLabelHeaders rawOrLabelHeaders = RawOrLabelHeaders.raw, bool exportCheckboxLabel = false) + public async Task ExportReportsAsync(string token, int reportId, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json, RawOrLabel rawOrLabel = RawOrLabel.raw, RawOrLabelHeaders rawOrLabelHeaders = RawOrLabelHeaders.raw, bool exportCheckboxLabel = false, string csvDelimiter = default, string decimalCharacter = default) { try { @@ -3778,7 +3976,7 @@ public async Task ExportReportsAsync(string token, int reportId, ReturnF { "content", Content.Report.GetDisplayName() }, { "report_id", reportId.ToString() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; // Optional var _rawOrLabel = rawOrLabel.ToString(); @@ -3795,7 +3993,14 @@ public async Task ExportReportsAsync(string token, int reportId, ReturnF { payload.Add("exportCheckboxLabel", exportCheckboxLabel.ToString()); } - + if (!IsNullOrEmpty(csvDelimiter)) + { + payload.Add("csvDelimiter", csvDelimiter.ToString()); + } + if (!IsNullOrEmpty(decimalCharacter)) + { + payload.Add("decimalCharacter", decimalCharacter.ToString()); + } return await this.SendPostRequestAsync(payload, _uri); } catch (Exception Ex) @@ -3809,8 +4014,7 @@ public async Task ExportReportsAsync(string token, int reportId, ReturnF } /// - /// API Version 1.0.0+ - /// Export Reports + /// Export Reports
/// This method allows you to export the data set of a report created on a project's 'Data Exports, Reports, and Stats' page. /// Note about export rights: Please be aware that Data Export user rights will be applied to this API request.For example, if you have 'No Access' data export rights in the project, then the API report export will fail and return an error. And if you have 'De-Identified' or 'Remove all tagged Identifier fields' data export rights, then some data fields *might* be removed and filtered out of the data set returned from the API. To make sure that no data is unnecessarily filtered out of your API request, you should have 'Full Data Set' export rights in the project. /// Also, please note the the 'Export Reports' method does *not* make use of the 'type' (flat/eav) parameter, which can be used in the 'Export Records' method.All data for the 'Export Reports' method is thus exported in flat format.If the 'type' parameter is supplied in the API request, it will be ignored. @@ -3822,12 +4026,14 @@ public async Task ExportReportsAsync(string token, int reportId, ReturnF /// report /// the report ID number provided next to the report name on the report list page /// csv, json [default], xml odm ('odm' refers to CDISC ODM XML format, specifically ODM version 1.3.1) - /// csv, json [default], xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json [default], xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// raw [default], label - export the raw coded values or labels for the options of multiple choice fields /// raw [default], label - (for 'csv' format 'flat' type only) for the CSV headers, export the variable/field names (raw) or the field labels (label) /// true, false [default] - specifies the format of checkbox field values specifically when exporting the data as labels (i.e., when rawOrLabel=label). When exporting labels, by default (without providing the exportCheckboxLabel flag or if exportCheckboxLabel=false), all checkboxes will either have a value 'Checked' if they are checked or 'Unchecked' if not checked. But if exportCheckboxLabel is set to true, it will instead export the checkbox value as the checkbox option's label (e.g., 'Choice 1') if checked or it will be blank/empty (no value) if not checked. If rawOrLabel=false, then the exportCheckboxLabel flag is ignored. + /// + /// /// Data from the project in the format and type specified ordered by the record (primary key of project) and then by event id - public async Task ExportReportsAsync(string token, Content content, int reportId, ReturnFormat format = ReturnFormat.json, OnErrorFormat onErrorFormat = OnErrorFormat.json, RawOrLabel rawOrLabel = RawOrLabel.raw, RawOrLabelHeaders rawOrLabelHeaders = RawOrLabelHeaders.raw, bool exportCheckboxLabel = false) + public async Task ExportReportsAsync(string token, Content content, int reportId, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json, RawOrLabel rawOrLabel = RawOrLabel.raw, RawOrLabelHeaders rawOrLabelHeaders = RawOrLabelHeaders.raw, bool exportCheckboxLabel = false, string csvDelimiter = default, string decimalCharacter = default) { try { @@ -3841,7 +4047,7 @@ public async Task ExportReportsAsync(string token, Content content, int { "content", content.GetDisplayName() }, { "report_id", reportId.ToString() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; // Optional var _rawOrLabel = rawOrLabel.ToString(); @@ -3858,7 +4064,14 @@ public async Task ExportReportsAsync(string token, Content content, int { payload.Add("exportCheckboxLabel", exportCheckboxLabel.ToString()); } - + if (!IsNullOrEmpty(csvDelimiter)) + { + payload.Add("csvDelimiter", csvDelimiter.ToString()); + } + if (!IsNullOrEmpty(decimalCharacter)) + { + payload.Add("decimalCharacter", decimalCharacter.ToString()); + } return await this.SendPostRequestAsync(payload, _uri); } catch (Exception Ex) @@ -3874,8 +4087,7 @@ public async Task ExportReportsAsync(string token, Content content, int #region Redcap /// - /// API Version 1.0.0+ - /// Export REDCap Version + /// Export REDCap Version
/// This method returns the current REDCap version number as plain text (e.g., 4.13.18, 5.12.2, 6.0.0). ///
/// @@ -3883,10 +4095,10 @@ public async Task ExportReportsAsync(string token, Content content, int /// To use this method, you must have API Export privileges in the project. /// /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. - /// + /// version /// csv, json [default], xml /// The current REDCap version number (three numbers delimited with two periods) as plain text - e.g., 4.13.18, 5.12.2, 6.0.0 - public async Task ExportRedcapVersionAsync(string token, Content content = Content.Version, ReturnFormat format = ReturnFormat.json) + public async Task ExportRedcapVersionAsync(string token, Content content = Content.Version, RedcapFormat format = RedcapFormat.json) { try { @@ -3914,8 +4126,7 @@ public async Task ExportRedcapVersionAsync(string token, Content content } /// - /// API Version 1.0.0+ - /// Export REDCap Version + /// Export REDCap Version
/// This method returns the current REDCap version number as plain text (e.g., 4.13.18, 5.12.2, 6.0.0). ///
/// @@ -3925,7 +4136,7 @@ public async Task ExportRedcapVersionAsync(string token, Content content /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. /// csv, json [default], xml /// The current REDCap version number (three numbers delimited with two periods) as plain text - e.g., 4.13.18, 5.12.2, 6.0.0 - public async Task ExportRedcapVersionAsync(string token, ReturnFormat format = ReturnFormat.json) + public async Task ExportRedcapVersionAsync(string token, RedcapFormat format = RedcapFormat.json) { try { @@ -3954,8 +4165,7 @@ public async Task ExportRedcapVersionAsync(string token, ReturnFormat fo #endregion Reports #region Surveys /// - /// API Version 1.0.0+ - /// From Redcap Version 6.4.0 + /// From Redcap Version 6.4.0
/// Export a Survey Link for a Participant /// This method returns a unique survey link (i.e., a URL) in plain text format for a specified record and data collection instrument (and event, if longitudinal) in a project. If the user does not have 'Manage Survey Participants' privileges, they will not be able to use this method, and an error will be returned. If the specified data collection instrument has not been enabled as a survey in the project, an error will be returned. ///
@@ -3968,9 +4178,9 @@ public async Task ExportRedcapVersionAsync(string token, ReturnFormat fo /// the unique instrument name as seen in the second column of the Data Dictionary. This instrument must be enabled as a survey in the project. /// the unique event name (for longitudinal projects only). /// (only for projects with repeating instruments/events) The repeat instance number of the repeating event (if longitudinal) or the repeating instrument (if classic or longitudinal). Default value is '1'. - /// csv, json [default], xml - The returnFormat is only used with regard to the format of any error messages that might be returned. + /// csv, json [default], xml - The returnFormat is only used with regard to the format of any error messages that might be returned. /// Returns a unique survey link (i.e., a URL) in plain text format for the specified record and instrument (and event, if longitudinal). - public async Task ExportSurveyLinkAsync(string token, string record, string instrument, string eventName, int repeatInstance, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportSurveyLinkAsync(string token, string record, string instrument, string eventName, int repeatInstance, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -3986,7 +4196,7 @@ public async Task ExportSurveyLinkAsync(string token, string record, str { "instrument", instrument }, { "event", eventName }, { "repeat_instance", repeatInstance.ToString() }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; return await this.SendPostRequestAsync(payload, _uri); @@ -4002,9 +4212,8 @@ public async Task ExportSurveyLinkAsync(string token, string record, str } /// - /// API Version 1.0.0+ - /// From Redcap Version 6.4.0 - /// Export a Survey Link for a Participant + /// From Redcap Version 6.4.0
+ /// Export a Survey Link for a Participant
/// This method returns a unique survey link (i.e., a URL) in plain text format for a specified record and data collection instrument (and event, if longitudinal) in a project. If the user does not have 'Manage Survey Participants' privileges, they will not be able to use this method, and an error will be returned. If the specified data collection instrument has not been enabled as a survey in the project, an error will be returned. ///
/// @@ -4017,9 +4226,9 @@ public async Task ExportSurveyLinkAsync(string token, string record, str /// the unique instrument name as seen in the second column of the Data Dictionary. This instrument must be enabled as a survey in the project. /// the unique event name (for longitudinal projects only). /// (only for projects with repeating instruments/events) The repeat instance number of the repeating event (if longitudinal) or the repeating instrument (if classic or longitudinal). Default value is '1'. - /// csv, json [default], xml - The returnFormat is only used with regard to the format of any error messages that might be returned. + /// csv, json [default], xml - The returnFormat is only used with regard to the format of any error messages that might be returned. /// Returns a unique survey link (i.e., a URL) in plain text format for the specified record and instrument (and event, if longitudinal). - public async Task ExportSurveyLinkAsync(string token, Content content, string record, string instrument, string eventName, int repeatInstance, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportSurveyLinkAsync(string token, Content content, string record, string instrument, string eventName, int repeatInstance, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -4035,7 +4244,7 @@ public async Task ExportSurveyLinkAsync(string token, Content content, s { "instrument", instrument }, { "event", eventName }, { "repeat_instance", repeatInstance.ToString() }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; return await this.SendPostRequestAsync(payload, _uri); @@ -4051,8 +4260,7 @@ public async Task ExportSurveyLinkAsync(string token, Content content, s } /// - /// API Version 1.0.0+ - /// Export a Survey Participant List + /// Export a Survey Participant List
/// This method returns the list of all participants for a specific survey instrument (and for a specific event, if a longitudinal project). If the user does not have 'Manage Survey Participants' privileges, they will not be able to use this method, and an error will be returned. If the specified data collection instrument has not been enabled as a survey in the project, an error will be returned. ///
/// @@ -4063,9 +4271,9 @@ public async Task ExportSurveyLinkAsync(string token, Content content, s /// the unique instrument name as seen in the second column of the Data Dictionary. This instrument must be enabled as a survey in the project. /// the unique event name (for longitudinal projects only). /// csv, json [default], xml - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Returns the list of all participants for the specified survey instrument [and event] in the desired format. The following fields are returned: email, email_occurrence, identifier, invitation_sent_status, invitation_send_time, response_status, survey_access_code, survey_link. The attribute 'email_occurrence' represents the current count that the email address has appeared in the list (because emails can be used more than once), thus email + email_occurrence represent a unique value pair. 'invitation_sent_status' is '0' if an invitation has not yet been sent to the participant, and is '1' if it has. 'invitation_send_time' is the date/time in which the next invitation will be sent, and is blank if there is no invitation that is scheduled to be sent. 'response_status' represents whether the participant has responded to the survey, in which its value is 0, 1, or 2 for 'No response', 'Partial', or 'Completed', respectively. Note: If an incorrect event_id or instrument name is used or if the instrument has not been enabled as a survey, then an error will be returned. - public async Task ExportSurveyParticipantsAsync(string token, string instrument, string eventName, ReturnFormat format = ReturnFormat.json, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportSurveyParticipantsAsync(string token, string instrument, string eventName, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -4080,7 +4288,7 @@ public async Task ExportSurveyParticipantsAsync(string token, string ins { "format", format.GetDisplayName() }, { "instrument", instrument }, { "event", eventName }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; return await this.SendPostRequestAsync(payload, _uri); @@ -4096,8 +4304,7 @@ public async Task ExportSurveyParticipantsAsync(string token, string ins } /// - /// API Version 1.0.0+ - /// Export a Survey Participant List + /// Export a Survey Participant List
/// This method returns the list of all participants for a specific survey instrument (and for a specific event, if a longitudinal project). If the user does not have 'Manage Survey Participants' privileges, they will not be able to use this method, and an error will be returned. If the specified data collection instrument has not been enabled as a survey in the project, an error will be returned. ///
/// @@ -4109,9 +4316,9 @@ public async Task ExportSurveyParticipantsAsync(string token, string ins /// the unique instrument name as seen in the second column of the Data Dictionary. This instrument must be enabled as a survey in the project. /// the unique event name (for longitudinal projects only). /// csv, json [default], xml - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Returns the list of all participants for the specified survey instrument [and event] in the desired format. The following fields are returned: email, email_occurrence, identifier, invitation_sent_status, invitation_send_time, response_status, survey_access_code, survey_link. The attribute 'email_occurrence' represents the current count that the email address has appeared in the list (because emails can be used more than once), thus email + email_occurrence represent a unique value pair. 'invitation_sent_status' is '0' if an invitation has not yet been sent to the participant, and is '1' if it has. 'invitation_send_time' is the date/time in which the next invitation will be sent, and is blank if there is no invitation that is scheduled to be sent. 'response_status' represents whether the participant has responded to the survey, in which its value is 0, 1, or 2 for 'No response', 'Partial', or 'Completed', respectively. Note: If an incorrect event_id or instrument name is used or if the instrument has not been enabled as a survey, then an error will be returned. - public async Task ExportSurveyParticipantsAsync(string token, Content content, string instrument, string eventName, ReturnFormat format = ReturnFormat.json, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportSurveyParticipantsAsync(string token, Content content, string instrument, string eventName, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -4126,7 +4333,7 @@ public async Task ExportSurveyParticipantsAsync(string token, Content co { "format", format.GetDisplayName() }, { "instrument", instrument }, { "event", eventName }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; return await this.SendPostRequestAsync(payload, _uri); @@ -4142,10 +4349,9 @@ public async Task ExportSurveyParticipantsAsync(string token, Content co } /// - /// API Version 1.0.0+ - /// From Redcap Version 6.4.0 + /// From Redcap Version 6.4.0
/// - /// Export a Survey Queue Link for a Participant + /// Export a Survey Queue Link for a Participant
/// This method returns a unique Survey Queue link (i.e., a URL) in plain text format for the specified record in a project that is utilizing the Survey Queue feature. If the user does not have 'Manage Survey Participants' privileges, they will not be able to use this method, and an error will be returned. If the Survey Queue feature has not been enabled in the project, an error will be ///
/// @@ -4153,9 +4359,9 @@ public async Task ExportSurveyParticipantsAsync(string token, Content co /// /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. /// the record ID. The name of the record in the project. - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Returns a unique Survey Queue link (i.e., a URL) in plain text format for the specified record in the project. - public async Task ExportSurveyQueueLinkAsync(string token, string record, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportSurveyQueueLinkAsync(string token, string record, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -4168,7 +4374,7 @@ public async Task ExportSurveyQueueLinkAsync(string token, string record { "token", token }, { "content", Content.SurveyQueueLink.GetDisplayName() }, { "record", record }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; return await this.SendPostRequestAsync(payload, _uri); @@ -4184,10 +4390,9 @@ public async Task ExportSurveyQueueLinkAsync(string token, string record } /// - /// API Version 1.0.0+ - /// From Redcap Version 6.4.0 + /// From Redcap Version 6.4.0
/// - /// Export a Survey Queue Link for a Participant + /// Export a Survey Queue Link for a Participant
/// This method returns a unique Survey Queue link (i.e., a URL) in plain text format for the specified record in a project that is utilizing the Survey Queue feature. If the user does not have 'Manage Survey Participants' privileges, they will not be able to use this method, and an error will be returned. If the Survey Queue feature has not been enabled in the project, an error will be ///
/// @@ -4196,9 +4401,9 @@ public async Task ExportSurveyQueueLinkAsync(string token, string record /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. /// surveyQueueLink /// the record ID. The name of the record in the project. - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Returns a unique Survey Queue link (i.e., a URL) in plain text format for the specified record in the project. - public async Task ExportSurveyQueueLinkAsync(string token, Content content, string record, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportSurveyQueueLinkAsync(string token, Content content, string record, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -4211,7 +4416,7 @@ public async Task ExportSurveyQueueLinkAsync(string token, Content conte { "token", token }, { "content", content.GetDisplayName() }, { "record", record }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; return await this.SendPostRequestAsync(payload, _uri); @@ -4227,9 +4432,8 @@ public async Task ExportSurveyQueueLinkAsync(string token, Content conte } /// - /// API Version 1.0.0+ - /// From Redcap Version 6.4.0 - /// Export a Survey Return Code for a Participant + /// From Redcap Version 6.4.0
+ /// Export a Survey Return Code for a Participant
/// This method returns a unique Return Code in plain text format for a specified record and data collection instrument (and event, if longitudinal) in a project. If the user does not have 'Manage Survey Participants' privileges, they will not be able to use this method, and an error will be returned. If the specified data collection instrument has not been enabled as a survey in the project or does not have the 'Save and Return Later' feature enabled, an error will be returned. ///
/// @@ -4240,9 +4444,9 @@ public async Task ExportSurveyQueueLinkAsync(string token, Content conte /// the unique instrument name as seen in the second column of the Data Dictionary. This instrument must be enabled as a survey in the project. /// the unique event name (for longitudinal projects only). /// (only for projects with repeating instruments/events) The repeat instance number of the repeating event (if longitudinal) or the repeating instrument (if classic or longitudinal). Default value is '1'. - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Returns a unique Return Code in plain text format for the specified record and instrument (and event, if longitudinal). - public async Task ExportSurveyReturnCodeAsync(string token, string record, string instrument, string eventName, string repeatInstance, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportSurveyReturnCodeAsync(string token, string record, string instrument, string eventName, string repeatInstance, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -4261,7 +4465,7 @@ public async Task ExportSurveyReturnCodeAsync(string token, string recor { "instrument", instrument }, { "event", eventName }, { "repeat_instance", repeatInstance.ToString()}, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; return await this.SendPostRequestAsync(payload, _uri); @@ -4277,9 +4481,8 @@ public async Task ExportSurveyReturnCodeAsync(string token, string recor } /// - /// API Version 1.0.0+ - /// From Redcap Version 6.4.0 - /// Export a Survey Return Code for a Participant + /// From Redcap Version 6.4.0
+ /// Export a Survey Return Code for a Participant
/// This method returns a unique Return Code in plain text format for a specified record and data collection instrument (and event, if longitudinal) in a project. If the user does not have 'Manage Survey Participants' privileges, they will not be able to use this method, and an error will be returned. If the specified data collection instrument has not been enabled as a survey in the project or does not have the 'Save and Return Later' feature enabled, an error will be returned. ///
/// @@ -4291,9 +4494,9 @@ public async Task ExportSurveyReturnCodeAsync(string token, string recor /// the unique instrument name as seen in the second column of the Data Dictionary. This instrument must be enabled as a survey in the project. /// the unique event name (for longitudinal projects only). /// (only for projects with repeating instruments/events) The repeat instance number of the repeating event (if longitudinal) or the repeating instrument (if classic or longitudinal). Default value is '1'. - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Returns a unique Return Code in plain text format for the specified record and instrument (and event, if longitudinal). - public async Task ExportSurveyReturnCodeAsync(string token, Content content, string record, string instrument, string eventName, string repeatInstance, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportSurveyReturnCodeAsync(string token, Content content, string record, string instrument, string eventName, string repeatInstance, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -4312,7 +4515,7 @@ public async Task ExportSurveyReturnCodeAsync(string token, Content cont { "instrument", instrument }, { "event", eventName }, { "repeat_instance", repeatInstance.ToString()}, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; return await this.SendPostRequestAsync(payload, _uri); @@ -4342,10 +4545,10 @@ public async Task ExportSurveyReturnCodeAsync(string token, Content cont /// /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. /// csv, json [default], xml - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// The method will return all the attributes below with regard to user privileges in the format specified. Please note that the 'forms' attribute is the only attribute that contains sub-elements (one for each data collection instrument), in which each form will have its own Form Rights value (see the key below to learn what each numerical value represents). Most user privilege attributes are boolean (0=No Access, 1=Access). Attributes returned: /// username, email, firstname, lastname, expiration, data_access_group, design, user_rights, data_access_groups, data_export, reports, stats_and_charts, manage_survey_participants, calendar, data_import_tool, data_comparison_tool, logging, file_repository, data_quality_create, data_quality_execute, api_export, api_import, mobile_app, mobile_app_download_data, record_create, record_rename, record_delete, lock_records_customization, lock_records, lock_records_all_forms, forms - public async Task ExportUsersAsync(string token, ReturnFormat format = ReturnFormat.json, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportUsersAsync(string token, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -4361,7 +4564,7 @@ public async Task ExportUsersAsync(string token, ReturnFormat format = R { "token", token }, { "content", Content.User.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; return await this.SendPostRequestAsync(payload, _uri); @@ -4391,11 +4594,11 @@ public async Task ExportUsersAsync(string token, ReturnFormat format = R /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. /// user /// csv, json [default], xml - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// The method will return all the attributes below with regard to user privileges in the format specified. Please note that the 'forms' attribute is the only attribute that contains sub-elements (one for each data collection instrument), in which each form will have its own Form Rights value (see the key below to learn what each numerical value represents). Most user privilege attributes are boolean (0=No Access, 1=Access). Attributes returned: /// username, email, firstname, lastname, expiration, data_access_group, design, user_rights, data_access_groups, data_export, reports, stats_and_charts, manage_survey_participants, calendar, data_import_tool, data_comparison_tool, logging, file_repository, data_quality_create, data_quality_execute, api_export, api_import, mobile_app, mobile_app_download_data, record_create, record_rename, record_delete, lock_records_customization, lock_records, lock_records_all_forms, forms /// - public async Task ExportUsersAsync(string token, Content content = Content.User, ReturnFormat format = ReturnFormat.json, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportUsersAsync(string token, Content content = Content.User, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -4411,7 +4614,7 @@ public async Task ExportUsersAsync(string token, Content content = Conte { "token", token }, { "content", content.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; return await this.SendPostRequestAsync(payload, _uri); @@ -4464,9 +4667,9 @@ public async Task ExportUsersAsync(string token, Content content = Conte /// "forms":{"demographics":"1","day_3":"2","other":"0"}}] /// /// csv, json [default], xml - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Number of users added or updated - public async Task ImportUsersAsync(string token, List data, ReturnFormat format = ReturnFormat.json, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ImportUsersAsync(string token, List data, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -4484,7 +4687,7 @@ public async Task ImportUsersAsync(string token, List data, Return { "token", token }, { "content", Content.User.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() }, + { "returnFormat", returnFormat.GetDisplayName() }, { "data", _serializedData } }; @@ -4539,9 +4742,9 @@ public async Task ImportUsersAsync(string token, List data, Return /// "forms":{"demographics":"1","day_3":"2","other":"0"}}] /// /// csv, json [default], xml - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Number of users added or updated - public async Task ImportUsersAsync(string token, Content content, List data, ReturnFormat format = ReturnFormat.json, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ImportUsersAsync(string token, Content content, List data, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -4559,7 +4762,7 @@ public async Task ImportUsersAsync(string token, Content content, Lis { "token", token }, { "content", content.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() }, + { "returnFormat", returnFormat.GetDisplayName() }, { "data", _serializedData } }; @@ -4640,7 +4843,7 @@ public async Task DeleteUsersAsync(string token, List users, Con /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. /// userRole /// csv, json [default], xml - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// The method will return all the attributes below with regard to user roles privileges in the format specified. Please note that the 'forms' attribute is the only attribute that contains sub-elements (one for each data collection instrument), in which each form will have its own Form Rights value (see the key below to learn what each numerical value represents). /// Most user role privilege attributes are boolean (0=No Access, 1=Access). Attributes returned: /// unique_role_name, role_label, design, user_rights, data_access_groups, data_export, reports, stats_and_charts, manage_survey_participants, calendar, data_import_tool, data_comparison_tool, logging, file_repository, data_quality_create, data_quality_execute, api_export, api_import, mobile_app, mobile_app_download_data, record_create, record_rename, record_delete, lock_records_customization, lock_records, lock_records_all_forms, forms @@ -4662,7 +4865,7 @@ public async Task DeleteUsersAsync(string token, List users, Con /// /// /// - public async Task ExportUserRolesAsync(string token, Content content = Content.UserRole, ReturnFormat format = ReturnFormat.json, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportUserRolesAsync(string token, Content content = Content.UserRole, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { try { @@ -4679,7 +4882,7 @@ public async Task ExportUserRolesAsync(string token, Content content = C { "token", token }, { "content", content.GetDisplayName() }, { "format", format.GetDisplayName() }, - { "returnFormat", onErrorFormat.GetDisplayName() } + { "returnFormat", returnFormat.GetDisplayName() } }; return await this.SendPostRequestAsync(payload, _uri); @@ -4712,10 +4915,11 @@ public async Task ExportUserRolesAsync(string token, Content content = C /// Other attribute values: 0=No Access, 1=Access. /// All available attributes: unique_role_name, role_label, design, user_rights, data_access_groups, data_export, reports, stats_and_charts, manage_survey_participants, calendar, data_import_tool, data_comparison_tool, logging, file_repository, data_quality_create, data_quality_execute, api_export, api_import, mobile_app, mobile_app_download_data, record_create, record_rename, record_delete, lock_records_customization, lock_records, lock_records_all_forms, forms /// + /// userRole /// csv, json [default], xml - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Number of user roles added or updated - public async Task ImportUserRolesAsync(string token, List data, Content content = Content.UserRole, ReturnFormat format = ReturnFormat.json, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ImportUserRolesAsync(string token, List data, Content content = Content.UserRole, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) { var importUserRolesResult = string.Empty; try @@ -4726,7 +4930,7 @@ public async Task ImportUserRolesAsync(string token, List data, Co { "token", _token }, { "content", content.ToString() }, { "format", format.ToString() }, - { "returnFormat", onErrorFormat.ToString() }, + { "returnFormat", returnFormat.ToString() }, { "data", _serializedData } }; // Execute request @@ -4806,7 +5010,7 @@ public async Task DeleteUserRolesAsync(string token, List roles, /// csv, json [default], xml /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// User-Role assignments for the project in the format specified - public async Task ExportUserRoleAssignmentAsync(string token, Content content = Content.UserRoleMapping, ReturnFormat format = ReturnFormat.json, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ExportUserRoleAssignmentAsync(string token, Content content = Content.UserRoleMapping, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat onErrorFormat = RedcapReturnFormat.json) { var exportUserRolesAssignmentResult = string.Empty; try @@ -4862,7 +5066,7 @@ public async Task ExportUserRoleAssignmentAsync(string token, Content co /// csv, json [default], xml /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. /// Number of User-Role assignments added or updated - public async Task ImportUserRoleAssignmentAsync(string token, List data, Content content = Content.UserRoleMapping, RedcapAction action = RedcapAction.Import, ReturnFormat format = ReturnFormat.json, OnErrorFormat onErrorFormat = OnErrorFormat.json) + public async Task ImportUserRoleAssignmentAsync(string token, List data, Content content = Content.UserRoleMapping, RedcapAction action = RedcapAction.Import, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat onErrorFormat = RedcapReturnFormat.json) { var importUserRoleAssignmentResult = string.Empty; try @@ -4888,238 +5092,6 @@ public async Task ImportUserRoleAssignmentAsync(string token, List } #endregion User Roles - #region File Repository - - /// - /// From Redcap Version 13.1

- /// - /// Create a New Folder in the File Repository

- /// - /// This method allows you to create a new folder in the File Repository.
- /// You may optionally provide the folder_id of the parent folder under which you wish this folder to be created.
- /// Providing a dag_id and/or role_id will allow you to restrict access to only users within a specific DAG (Data Access Group) or User Role, respectively. - /// - ///
- /// - /// - /// To use this method, you must have API Import/Update privileges and File Repository privileges in the project. - /// - /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. - /// fileRepository - /// createFolder - /// The desired name of the folder to be created (max length = 150 characters) - /// csv, json [default], xml - /// the folder_id of a specific folder in the File Repository for which you wish to create this sub-folder. If none is provided, the folder will be created in the top-level directory of the File Repository. - /// the dag_id of the DAG (Data Access Group) to which you wish to restrict access for this folder. If none is provided, the folder will accessible to users in all DAGs and users in no DAGs. - /// the role_id of the User Role to which you wish to restrict access for this folder. If none is provided, the folder will accessible to users in all User Roles and users in no User Roles. - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. - /// - /// The folder_id of the new folder created in the specified format.
For example, if using format=json, the output would look similar to this: [{folder_id:45}].
- public async Task CreateFolderFileRepositoryAsync(string token, Content content = Content.FileRepository, RedcapAction action = RedcapAction.CreateFolder, string name = null, RedcapFormat format = RedcapFormat.json, string folderId = null, string dagId = null, string roleId = null, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) - { - /* - * Check the required parameters for empty or null - */ - if (IsNullOrEmpty(token)) - { - throw new ArgumentNullException("Please provide a valid Redcap token."); - } - if (IsNullOrEmpty(name)) - { - throw new ArgumentNullException("Please provide a valid name for the folder to create in the Repository."); - } - var payload = new Dictionary - { - { "token", token }, - { "content", content.GetDisplayName() }, - { "action", action.GetDisplayName() }, - { "format", format.GetDisplayName() }, - { "returnFormat", returnFormat.GetDisplayName() } - }; - // Optional - if (!IsNullOrEmpty(folderId)) - { - payload.Add("folder_id", folderId); - } - if (!IsNullOrEmpty(dagId)) - { - payload.Add("dag_id", dagId); - } - if (!IsNullOrEmpty(roleId)) - { - payload.Add("role_id", roleId); - } - - // Execute send request - return await this.SendPostRequestAsync(payload, _uri); - - } - /// - /// From Redcap Version 13.1
- /// - /// Export a List of Files/Folders from the File Repository

- /// - ///
- /// - /// To use this method, you must have API Export privileges and File Repository privileges in the project. - /// - /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. - /// fileRepository - /// list - /// csv, json [default], xml - /// the folder_id of a specific folder in the File Repository for which you wish to export a list of its files and sub-folders. If none is provided, the top-level directory of the File Repository will be used. - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. - /// The list of all files and folders within a given sub-folder in the File Repository in the format specified. - /// - public async Task ExportFilesFoldersFileRepositoryAsync(string token, Content content = Content.FileRepository, RedcapAction action = RedcapAction.List, RedcapFormat format = RedcapFormat.json, string folderId = null, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) - { - /* - * Check the required parameters for empty or null - */ - if (IsNullOrEmpty(token)) - { - throw new ArgumentNullException("Please provide a valid Redcap token."); - } - var payload = new Dictionary - { - { "token", token }, - { "content", content.GetDisplayName() }, - { "action", action.GetDisplayName() }, - { "format", format.GetDisplayName() }, - { "returnFormat", returnFormat.GetDisplayName() } - }; - // Optional - if (!IsNullOrEmpty(folderId)) - { - payload.Add("folder_id", folderId); - } - - // Execute send request - return await this.SendPostRequestAsync(payload, _uri); - } - /// - /// From Redcap Version 13.1
- /// Export a File from the File Repository
- ///
- /// - /// To use this method, you must have API Export privileges and File Repository privileges in the project. - /// - /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. - /// fileRepository - /// export - /// the doc_id of the file in the File Repository - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. - /// the contents of the file - /// - public async Task ExportFileFileRepositoryAsync(string token, Content content = Content.FileRepository, RedcapAction action = RedcapAction.Export, string docId = null, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) - { - /* - * Check the required parameters for empty or null - */ - if (IsNullOrEmpty(token)) - { - throw new ArgumentNullException("Please provide a valid Redcap token."); - } - var payload = new Dictionary - { - { "token", token }, - { "content", content.GetDisplayName() }, - { "action", action.GetDisplayName() }, - { "returnFormat", returnFormat.GetDisplayName() } - }; - // Optional - if (!IsNullOrEmpty(docId)) - { - payload.Add("doc_id", docId); - } - - // Execute send request - return await this.SendPostRequestAsync(payload, _uri); - } - /// - /// From Redcap Version 13.1
- /// Import a File into the File Repository
- /// - ///
- /// - /// To use this method, you must have API Import/Update privileges and File Repository privileges in the project. - /// - /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. - /// fileRepository - /// import - /// the contents of the file - /// the folder_id of a specific folder in the File Repository where you wish to store the file. If none is provided, the file will be stored in the top-level directory of the File Repository. - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. - /// - /// - public async Task ImportFileRepositoryAsync(string token, Content content = Content.FileRepository, RedcapAction action = RedcapAction.Import, string file = null, string folderId = null, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) - { - /* - * Check the required parameters for empty or null - */ - if (IsNullOrEmpty(token)) - { - throw new ArgumentNullException("Please provide a valid Redcap token."); - } - if (IsNullOrEmpty(file)) - { - throw new ArgumentNullException("Please provide a file to import."); - } - var payload = new Dictionary - { - { "token", token }, - { "content", content.GetDisplayName() }, - { "action", action.GetDisplayName() }, - { "returnFormat", returnFormat.GetDisplayName() } - }; - // Optional - if (!IsNullOrEmpty(folderId)) - { - payload.Add("folder_id", folderId); - } - - // Execute send request - return await this.SendPostRequestAsync(payload, _uri); - } - /// - /// From Redcap Version 13.1
- /// Delete a File from the File Repository
- /// - ///
- /// - /// To use this method, you must have API Import/Update privileges and File Repository privileges in the project. - /// - /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. - /// fileRepository - /// delete - /// the doc_id of the file in the File Repository - /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. - /// - /// - public async Task DeleteFileRepositoryAsync(string token, Content content = Content.FileRepository, RedcapAction action = RedcapAction.Delete, string docId = null, RedcapReturnFormat returnFormat = RedcapReturnFormat.json) - { - /* - * Check the required parameters for empty or null - */ - if (IsNullOrEmpty(token)) - { - throw new ArgumentNullException("Please provide a valid Redcap token."); - } - if (IsNullOrEmpty(docId)) - { - throw new ArgumentNullException("Please provide a document id to delete."); - } - var payload = new Dictionary - { - { "token", token }, - { "content", content.GetDisplayName() }, - { "action", action.GetDisplayName() }, - { "returnFormat", returnFormat.GetDisplayName() } - }; - // Execute send request - return await this.SendPostRequestAsync(payload, _uri); - } - #endregion File Repository } diff --git a/RedcapApi/Interfaces/IRedcap.cs b/RedcapApi/Interfaces/IRedcap.cs index f27d378..74ef366 100644 --- a/RedcapApi/Interfaces/IRedcap.cs +++ b/RedcapApi/Interfaces/IRedcap.cs @@ -17,100 +17,1077 @@ namespace Redcap.Interfaces public interface IRedcap { #region Arms - Task ExportArmsAsync(string token, ReturnFormat format = ReturnFormat.json, string[] arms = null, OnErrorFormat onErrorFormat = OnErrorFormat.json); - Task ExportArmsAsync(string token, Content content = Content.Arm, ReturnFormat format = ReturnFormat.json, string[] arms = null, OnErrorFormat onErrorFormat = OnErrorFormat.json); - Task ImportArmsAsync(string token, Content content, Override overrideBhavior, RedcapAction action, ReturnFormat inputFormat, List data, OnErrorFormat returnFormat); - Task ImportArmsAsync(string token, Override overrideBhavior, RedcapAction action, ReturnFormat inputFormat, List data, OnErrorFormat returnFormat); + /// + /// From Redcap Version 4.7.0

+ /// Export Arms

+ /// This method allows you to export the Arms for a project + /// NOTE: This only works for longitudinal projects. + ///
+ /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// csv, json [default], xml + /// an array of arm numbers that you wish to pull events for (by default, all events are pulled) + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// Arms for the project in the format specified(only ones with Events available) + Task ExportArmsAsync(string token, RedcapFormat format, string[] arms, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + + /// + /// From Redcap Version 4.7.0

+ /// Export Arms

+ /// This method allows you to export the Arms for a project + /// NOTE: This only works for longitudinal projects. + ///
+ /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// + /// csv, json [default], xml + /// an array of arm numbers that you wish to pull events for (by default, all events are pulled) + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// Arms for the project in the format specified(only ones with Events available) + Task ExportArmsAsync(string token, Content content, RedcapFormat format, string[] arms, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + + /// + /// From Redcap Version 4.7.0

+ /// + /// Import Arms

+ /// This method allows you to import Arms into a project or to rename existing Arms in a project. + /// You may use the parameter override=1 as a 'delete all + import' action in order to erase all existing Arms in the project while importing new Arms. + /// Notice: Because of the 'override' parameter's destructive nature, this method may only use override=1 for projects in Development status. + /// NOTE: This only works for longitudinal projects. + /// + ///
+ /// + /// To use this method, you must have API Import/Update privileges *and* Project Design/Setup privileges in the project. + /// + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// arm + /// 0 - false [default], 1 - true — You may use override=1 as a 'delete all + import' action in order to erase all existing Arms in the project while importing new Arms. If override=0, then you can only add new Arms or rename existing ones. + /// import + /// csv, json [default], xml + /// Contains the attributes 'arm_num' (referring to the arm number) and 'name' (referring to the arm's name) of each arm to be created/modified, in which they are provided in the specified format. + /// [{"arm_num":"1","name":"Drug A"}, + /// {"arm_num":"2","name":"Drug B"}, + /// {"arm_num":"3","name":"Drug C"}] + /// + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'xml'. + /// Number of Arms imported + Task ImportArmsAsync(string token, Content content, Override overrideBhavior, RedcapAction action, RedcapFormat format, List data, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + + /// + /// From Redcap Version 4.7.0

+ /// + /// Import Arms

+ /// This method allows you to import Arms into a project or to rename existing Arms in a project. + /// You may use the parameter override=1 as a 'delete all + import' action in order to erase all existing Arms in the project while importing new Arms. + /// Notice: Because of the 'override' parameter's destructive nature, this method may only use override=1 for projects in Development status. + /// NOTE: This only works for longitudinal projects. + /// + ///
+ /// + /// To use this method, you must have API Import/Update privileges *and* Project Design/Setup privileges in the project. + /// + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// 0 - false [default], 1 - true — You may use override=1 as a 'delete all + import' action in order to erase all existing Arms in the project while importing new Arms. If override=0, then you can only add new Arms or rename existing ones. + /// import + /// csv, json [default], xml + /// Contains the attributes 'arm_num' (referring to the arm number) and 'name' (referring to the arm's name) of each arm to be created/modified, in which they are provided in the specified format. + /// [{"arm_num":"1","name":"Drug A"}, + /// {"arm_num":"2","name":"Drug B"}, + /// {"arm_num":"3","name":"Drug C"}] + /// + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'xml'. + /// Number of Arms imported + Task ImportArmsAsync(string token, Override overrideBhavior, RedcapAction action, RedcapFormat format, List data, RedcapReturnFormat returnFormat); + + /// + /// From Redcap Version 4.7.0

+ /// + /// Delete Arms

+ /// This method allows you to delete Arms from a project. + /// Notice: Because of this method's destructive nature, it is only available for use for projects in Development status. Additionally, please be aware that deleting an arm also automatically deletes all events that belong to that arm, and will also automatically delete any records/data that have been collected under that arm (this is non-reversible data loss). + /// NOTE: This only works for longitudinal projects. + ///
+ /// + /// To use this method, you must have API Import/Update privileges *and* Project Design/Setup privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// arm + /// delete + /// an array of arm numbers that you wish to delete + /// Number of Events deleted Task DeleteArmsAsync(string token, Content content, RedcapAction action, string[] arms); + + /// + /// From Redcap Version 4.7.0

+ /// + /// Delete Arms

+ /// + /// This method allows you to delete Arms from a project. + /// Notice: Because of this method's destructive nature, it is only available for use for projects in Development status. Additionally, please be aware that deleting an arm also automatically deletes all events that belong to that arm, and will also automatically delete any records/data that have been collected under that arm (this is non-reversible data loss). + /// NOTE: This only works for longitudinal projects. + ///
+ /// + /// To use this method, you must have API Import/Update privileges *and* Project Design/Setup privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// an array of arm numbers that you wish to delete + /// Number of Events deleted Task DeleteArmsAsync(string token, string[] arms); #endregion #region Data Access Groups - Task ExportDagsAsync(string token, Content content, ReturnFormat format = ReturnFormat.json, OnErrorFormat onErrorFormat = OnErrorFormat.json); - Task ImportDagsAsync(string token, Content content, RedcapAction action, ReturnFormat format, List data, OnErrorFormat onErrorFormat = OnErrorFormat.json); + /// + /// Export DAGs

+ /// This method allows you to export the Data Access Groups for a project + /// + /// To use this method, you must have API Export privileges in the project. + /// + ///
+ /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// dag + /// csv, json [default], xml + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// DAGs for the project in the format specified + Task ExportDagsAsync(string token, Content content = Content.Dag, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + + /// + /// Import DAGs + /// This method allows you to import new DAGs (Data Access Groups) into a project or update the group name of any existing DAGs. + /// NOTE: DAGs can be renamed by simply changing the group name(data_access_group_name). + /// DAG can be created by providing group name value while unique group name should be set to blank. + /// + /// + /// To use this method, you must have API Import/Update privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// dags + /// import + /// csv, json [default], xml + /// Contains the attributes 'data_access_group_name' (referring to the group name) and 'unique_group_name' (referring to the auto-generated unique group name) of each DAG to be created/modified, in which they are provided in the specified format. + /// Refer to the API documenations for additional examples. + /// JSON Example: + /// [{"data_access_group_name":"CA Site","unique_group_name":"ca_site"} + /// {"data_access_group_name":"FL Site","unique_group_name":"fl_site"}, + /// { "data_access_group_name":"New Site","unique_group_name":""}] + /// CSV Example: + /// data_access_group_name,unique_group_name + /// "CA Site",ca_site + /// "FL Site",fl_site + /// "New Site", + /// + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// Number of DAGs added or updated + Task ImportDagsAsync(string token, Content content, RedcapAction action, RedcapFormat format, List data, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + + /// + /// Delete DAGs

+ /// This method allows you to delete DAGs from a project. + /// + /// To use this method, you must have API Import/Update privileges in the project. + /// + ///
+ /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// dag + /// delete + /// an array of unique group names that you wish to delete + /// Number of DAGs deleted Task DeleteDagsAsync(string token, Content content, RedcapAction action, string[] dags); + + /// + /// From Redcap Version 11.3.1

+ /// + /// Switch DAG

+ /// This method allows the current API user to switch (assign/reassign/unassign) their current Data Access Group assignment if they have been assigned to multiple DAGs via the DAG Switcher page in the project. + /// + /// To use this method, you must have API Import/Update privileges in the project. + /// + ///
+ /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// dag + /// switch + /// The unique group name of the Data Access Group to which you wish to switch. + /// Returns "1" when the current API user is switched to the specified Data Access Group, otherwise it returns an error message. Task SwitchDagAsync(string token, RedcapDag dag, Content content = Content.Dag, RedcapAction action = RedcapAction.Switch); - Task ExportUserDagAssignmentAsync(string token, Content content, ReturnFormat format = ReturnFormat.json, OnErrorFormat onErrorFormat = OnErrorFormat.json); - Task ImportUserDagAssignmentAsync(string token, Content content, RedcapAction action, ReturnFormat format, List data, OnErrorFormat onErrorFormat = OnErrorFormat.json); + + /// + /// Export User-DAG Assignments
+ /// This method allows you to export existing User-DAG assignments for a project. + /// + ///
+ /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// userDagMapping + /// csv, json [default], xml + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// User-DAG assignments for the project in the format specified + Task ExportUserDagAssignmentAsync(string token, Content content, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + + /// + /// Import User-DAG Assignments

+ /// This method allows you to assign users to any data access group. + /// NOTE: If you wish to modify an existing mapping, you *must* provide its unique username and group name.If the 'redcap_data_access_group' column is not provided, user will not assigned to any group.There should be only one record per username. + /// + /// To use this method, you must have API Import/Update privileges in the project. + /// + ///
+ /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// userDagMapping + /// import + /// csv, json [default], xml + /// + /// Contains the attributes 'username' (referring to the existing unique username) and 'redcap_data_access_group' (referring to existing unique group name) of each User-DAG assignments to be modified, in which they are provided in the specified format. + /// JSON Example: + /// [{"username":"ca_dt_person","redcap_data_access_group":"ca_site"}, + /// {"username":"fl_dt_person","redcap_data_access_group":"fl_site"}, + /// { "username":"global_user","redcap_data_access_group":""}] + /// CSV Example: + /// username,redcap_data_access_group + /// ca_dt_person, ca_site + /// fl_dt_person, fl_site + /// global_user, + /// + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// Number of User-DAG assignments added or updated + Task ImportUserDagAssignmentAsync(string token, Content content, RedcapAction action, RedcapFormat format, List data, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); #endregion #region Events - Task ExportEventsAsync(string token, Content content = Content.Event, ReturnFormat inputFormat = ReturnFormat.json, string[] arms = null, OnErrorFormat returnFormat = OnErrorFormat.json); - Task ExportEventsAsync(string token, ReturnFormat inputFormat = ReturnFormat.json, string[] arms = null, OnErrorFormat returnFormat = OnErrorFormat.json); + /// + /// From Redcap Version 4.7.0

+ /// + /// Export Events

+ /// This method allows you to export the events for a project + /// NOTE: This only works for longitudinal projects. + /// + ///
+ /// + /// To use this method, you must have API Export privileges in the project. + /// + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// + /// event + /// csv, json [default], xml + /// + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// Events for the project in the format specified + Task ExportEventsAsync(string token, Content content, RedcapFormat format, string[] arms, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + + /// + /// From Redcap Version 4.7.0 + /// + /// Export Events + /// This method allows you to export the events for a project + /// NOTE: This only works for longitudinal projects. + /// + /// + /// + /// To use this method, you must have API Export privileges in the project. + /// + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// + /// csv, json [default], xml + /// + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// Events for the project in the format specified + Task ExportEventsAsync(string token, RedcapFormat format, string[] arms, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + + /// + /// From Redcap Version 6.11.0

+ /// + /// Import Events
+ /// This method allows you to import Events into a project or to update existing Events' attributes, such as the event name, days offset, etc. The unique event name of an Event cannot be changed because it is auto-generated by REDCap. Please note that the only way to update an existing Event is to provide the unique_event_name attribute, and if the unique_event_name attribute is missing for an Event being imported (when override=0), it will assume it to be a new Event that should be created. Notice: Because of the 'override' parameter's destructive nature, this method may only use override=1 for projects in Development status. + /// NOTE: This only works for longitudinal projects. + ///
+ /// + /// To use this method, you must have API Import/Update privileges *and* Project Design/Setup privileges in the project. + /// + /// + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// event + /// import + /// 0 - false [default], 1 - true — You may use override=1 as a 'delete all + import' action in order to erase all existing Events in the project while importing new Events. If override=0, then you can only add new Events or modify existing ones. + /// + /// Contains the required attributes 'event_name' (referring to the name/label of the event) and 'arm_num' (referring to the arm number to which the event belongs - assumes '1' if project only contains one arm). In order to modify an existing event, you must provide the attribute 'unique_event_name' (referring to the auto-generated unique event name of the given event). If the project utilizes the Scheduling module, the you may optionally provide the following attributes, which must be numerical: day_offset, offset_min, offset_max. If the day_offset is not provided, then the events will be auto-numbered in the order in which they are provided in the API request. + /// [{"event_name":"Baseline","arm_num":"1","day_offset":"1","offset_min":"0", + /// "offset_max":"0","unique_event_name":"baseline_arm_1"}, + /// {"event_name":"Visit 1","arm_num":"1","day_offset":"2","offset_min":"0", + /// "offset_max":"0","unique_event_name":"visit_1_arm_1"}, + /// {"event_name":"Visit 2","arm_num":"1","day_offset":"3","offset_min":"0", + /// "offset_max":"0","unique_event_name":"visit_2_arm_1"}] + /// + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// Number of Events imported + Task ImportEventsAsync(string token, Content content, RedcapAction action, Override overrideBehavior, RedcapFormat format, List data, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); - Task ImportEventsAsync(string token, Content content, RedcapAction action, Override overrideBhavior, ReturnFormat inputFormat, List data, OnErrorFormat returnFormat = OnErrorFormat.json); - Task ImportEventsAsync(string token, Override overrideBhavior, ReturnFormat inputFormat, List data, OnErrorFormat returnFormat = OnErrorFormat.json); + /// + /// From Redcap Version 6.11.0

+ /// + /// Import Events
+ /// This method allows you to import Events into a project or to update existing Events' attributes, such as the event name, days offset, etc. The unique event name of an Event cannot be changed because it is auto-generated by REDCap. Please note that the only way to update an existing Event is to provide the unique_event_name attribute, and if the unique_event_name attribute is missing for an Event being imported (when override=0), it will assume it to be a new Event that should be created. Notice: Because of the 'override' parameter's destructive nature, this method may only use override=1 for projects in Development status. + /// NOTE: This only works for longitudinal projects. + ///
+ /// + /// To use this method, you must have API Import/Update privileges *and* Project Design/Setup privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// 0 - false [default], 1 - true — You may use override=1 as a 'delete all + import' action in order to erase all existing Events in the project while importing new Events. If override=0, then you can only add new Events or modify existing ones. + /// + /// Contains the required attributes 'event_name' (referring to the name/label of the event) and 'arm_num' (referring to the arm number to which the event belongs - assumes '1' if project only contains one arm). In order to modify an existing event, you must provide the attribute 'unique_event_name' (referring to the auto-generated unique event name of the given event). If the project utilizes the Scheduling module, the you may optionally provide the following attributes, which must be numerical: day_offset, offset_min, offset_max. If the day_offset is not provided, then the events will be auto-numbered in the order in which they are provided in the API request. + /// [{"event_name":"Baseline","arm_num":"1","day_offset":"1","offset_min":"0", + /// "offset_max":"0","unique_event_name":"baseline_arm_1"}, + /// {"event_name":"Visit 1","arm_num":"1","day_offset":"2","offset_min":"0", + /// "offset_max":"0","unique_event_name":"visit_1_arm_1"}, + /// {"event_name":"Visit 2","arm_num":"1","day_offset":"3","offset_min":"0", + /// "offset_max":"0","unique_event_name":"visit_2_arm_1"}] + /// + /// csv, json [default], xml + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// Number of Events imported - Task DeleteEventsAsync(string token, Content content, RedcapAction action, string[] events); + Task ImportEventsAsync(string token, Override overrideBehavior, RedcapFormat format, List data, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + /// + /// From Redcap Version 6.11.0

+ /// + /// Delete Events

+ /// This method allows you to delete Events from a project.
+ /// Notice: Because of this method's destructive nature, it is only available for use for projects in Development status. + /// Additionally, please be aware that deleting an event will automatically delete any records/data that have been collected under that event (this is non-reversible data loss). + /// NOTE: This only works for longitudinal projects. + ///
+ /// + /// + /// To use this method, you must have API Import/Update privileges *and* Project Design/Setup privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// Array of unique event names + /// Number of Events deleted Task DeleteEventsAsync(string token, string[] events); + /// + /// From Redcap Version 6.11.0

+ /// + /// Delete Events

+ /// This method allows you to delete Events from a project.
+ /// Notice: Because of this method's destructive nature, it is only available for use for projects in Development status. + /// Additionally, please be aware that deleting an event will automatically delete any records/data that have been collected under that event (this is non-reversible data loss). + /// NOTE: This only works for longitudinal projects. + ///
+ /// + /// + /// To use this method, you must have API Import/Update privileges *and* Project Design/Setup privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// event + /// delete + /// Array of unique event names + /// Number of Events deleted + Task DeleteEventsAsync(string token, Content content, RedcapAction action, string[] events); #endregion #region Field Names - Task ExportFieldNamesAsync(string token, Content content = Content.ExportFieldNames, ReturnFormat inputFormat = ReturnFormat.json, string field = null, OnErrorFormat returnFormat = OnErrorFormat.json); - Task ExportFieldNamesAsync(string token, ReturnFormat inputFormat = ReturnFormat.json, string field = null, OnErrorFormat returnFormat = OnErrorFormat.json); + /// + /// Export List of Export Field Names (i.e. variables used during exports and imports)

+ /// + /// This method returns a list of the export/import-specific version of field names for all fields (or for one field, if desired) in a project. + /// This is mostly used for checkbox fields because during data exports and data imports, checkbox fields have a different variable name used than the exact one defined for them in the Online Designer and Data Dictionary, in which *each checkbox option* gets represented as its own export field name in the following format: field_name + triple underscore + converted coded value for the choice. + /// For non-checkbox fields, the export field name will be exactly the same as the original field name. + /// Note: The following field types will be automatically removed from the list returned by this method since they cannot be utilized during the data import process: 'calc', 'file', and 'descriptive'. + ///

+ /// The list that is returned will contain the three following attributes for each field/choice: 'original_field_name', 'choice_value', and 'export_field_name'. + /// The choice_value attribute represents the raw coded value for a checkbox choice.For non-checkbox fields, the choice_value attribute will always be blank/empty. + /// The export_field_name attribute represents the export/import-specific version of that field name. + ///
+ /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// csv, json [default], xml + /// A field's variable name. By default, all fields are returned, but if field is provided, then it will only the export field name(s) for that field. If the field name provided is invalid, it will return an error. + /// csv, json [default], xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// The list that is returned will contain the original field name (variable) of the field and also the export field name(s) of that field. + /// Returns a list of the export/import-specific version of field names for all fields (or for one field, if desired) in a project in the format specified and ordered by their field order . + /// The list that is returned will contain the three following attributes for each field/choice: 'original_field_name', 'choice_value', and 'export_field_name'. The choice_value attribute represents the raw coded value for a checkbox choice. For non-checkbox fields, the choice_value attribute will always be blank/empty. The export_field_name attribute represents the export/import-specific version of that field name. + /// + Task ExportFieldNamesAsync(string token, RedcapFormat format = RedcapFormat.json, string field = default, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + + /// + /// Export List of Export Field Names (i.e. variables used during exports and imports)

+ /// + /// This method returns a list of the export/import-specific version of field names for all fields (or for one field, if desired) in a project. + /// This is mostly used for checkbox fields because during data exports and data imports, checkbox fields have a different variable name used than the exact one defined for them in the Online Designer and Data Dictionary, in which *each checkbox option* gets represented as its own export field name in the following format: field_name + triple underscore + converted coded value for the choice. + /// For non-checkbox fields, the export field name will be exactly the same as the original field name. + /// Note: The following field types will be automatically removed from the list returned by this method since they cannot be utilized during the data import process: 'calc', 'file', and 'descriptive'. + ///

+ /// The list that is returned will contain the three following attributes for each field/choice: 'original_field_name', 'choice_value', and 'export_field_name'. + /// The choice_value attribute represents the raw coded value for a checkbox choice.For non-checkbox fields, the choice_value attribute will always be blank/empty. + /// The export_field_name attribute represents the export/import-specific version of that field name. + ///
+ /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// exportFieldNames + /// csv, json [default], xml + /// A field's variable name. By default, all fields are returned, but if field is provided, then it will only the export field name(s) for that field. If the field name provided is invalid, it will return an error. + /// csv, json [default], xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// The list that is returned will contain the original field name (variable) of the field and also the export field name(s) of that field. + /// Returns a list of the export/import-specific version of field names for all fields (or for one field, if desired) in a project in the format specified and ordered by their field order . + /// The list that is returned will contain the three following attributes for each field/choice: 'original_field_name', 'choice_value', and 'export_field_name'. The choice_value attribute represents the raw coded value for a checkbox choice. For non-checkbox fields, the choice_value attribute will always be blank/empty. The export_field_name attribute represents the export/import-specific version of that field name. + /// + + Task ExportFieldNamesAsync(string token, Content content = Content.ExportFieldNames, RedcapFormat format = RedcapFormat.json, string field = default, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); #endregion #region Files - Task ExportFileAsync(string token, Content content, RedcapAction action, string record, string field, string eventName, string repeatInstance = "1", OnErrorFormat returnFormat = OnErrorFormat.json, string filePath = null); - Task ExportFileAsync(string token, string record, string field, string eventName, string repeatInstance = "1", OnErrorFormat returnFormat = OnErrorFormat.json, string filePath = null); + /// + /// Export a File

+ /// This method allows you to download a document that has been attached to an individual record for a File Upload field. Please note that this method may also be used for Signature fields (i.e. File Upload fields with 'signature' validation type). + /// Note about export rights: Please be aware that Data Export user rights will be applied to this API request.For example, if you have 'No Access' data export rights in the project, then the API file export will fail and return an error. And if you have 'De-Identified' or 'Remove all tagged Identifier fields' data export rights, then the API file export will fail and return an error *only if* the File Upload field has been tagged as an Identifier field.To make sure that your API request does not return an error, you should have 'Full Data Set' export rights in the project. + ///

+ /// How to obtain the filename of the file: + /// The MIME type of the file, along with the name of the file and its extension, can be found in the header of the returned response.Thus in order to determine these attributes of the file being exported, you will need to parse the response header. Example: content-type = application / vnd.openxmlformats - officedocument.wordprocessingml.document; name='FILE_NAME.docx' + ///
+ /// + /// To use this method, you must have API Export privileges in the project.
+ /// + ///
+ /// + /// The MIME type of the file, along with the name of the file and its extension, can be found in the header of the returned response. Thus in order to determine these attributes of the file being exported, you will need to parse the response header. Example: content-type = application/vnd.openxmlformats-officedocument.wordprocessingml.document; name='FILE_NAME.docx' + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// the record ID + /// the name of the field that contains the file + /// the unique event name - only for longitudinal projects + /// (only for projects with repeating instruments/events) The repeat instance number of the repeating event (if longitudinal) or the repeating instrument (if classic or longitudinal). Default value is '1'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'xml'. + /// File path which the file will be saved. + /// the contents of the file + Task ExportFileAsync(string token, string record, string field, string eventName, string repeatInstance = "1", RedcapReturnFormat returnFormat = RedcapReturnFormat.json, string filePath = null); + /// + /// Export a File

+ /// This method allows you to download a document that has been attached to an individual record for a File Upload field. Please note that this method may also be used for Signature fields (i.e. File Upload fields with 'signature' validation type). + /// Note about export rights: Please be aware that Data Export user rights will be applied to this API request.For example, if you have 'No Access' data export rights in the project, then the API file export will fail and return an error. And if you have 'De-Identified' or 'Remove all tagged Identifier fields' data export rights, then the API file export will fail and return an error *only if* the File Upload field has been tagged as an Identifier field.To make sure that your API request does not return an error, you should have 'Full Data Set' export rights in the project. + ///

+ /// How to obtain the filename of the file: + /// The MIME type of the file, along with the name of the file and its extension, can be found in the header of the returned response.Thus in order to determine these attributes of the file being exported, you will need to parse the response header. Example: content-type = application / vnd.openxmlformats - officedocument.wordprocessingml.document; name='FILE_NAME.docx' + ///
+ /// + /// To use this method, you must have API Export privileges in the project.
+ /// + ///
+ /// + /// The MIME type of the file, along with the name of the file and its extension, can be found in the header of the returned response. Thus in order to determine these attributes of the file being exported, you will need to parse the response header. Example: content-type = application/vnd.openxmlformats-officedocument.wordprocessingml.document; name='FILE_NAME.docx' + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// file + /// export + /// the record ID + /// the name of the field that contains the file + /// the unique event name - only for longitudinal projects + /// (only for projects with repeating instruments/events) The repeat instance number of the repeating event (if longitudinal) or the repeating instrument (if classic or longitudinal). Default value is '1'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'xml'. + /// File path which the file will be saved. + /// the file name that was exported + Task ExportFileAsync(string token, Content content, RedcapAction action, string record, string field, string eventName, string repeatInstance = "1", RedcapReturnFormat returnFormat = RedcapReturnFormat.json, string filePath = null); - Task ImportFileAsync(string token, Content content, RedcapAction action, string record, string field, string eventName, string repeatInstance, string fileName, string filePath, OnErrorFormat returnFormat = OnErrorFormat.json); - Task ImportFileAsync(string token, string record, string field, string eventName, string repeatInstance, string fileName, string filePath, OnErrorFormat returnFormat = OnErrorFormat.json); + /// + /// Import a File

+ /// This method allows you to upload a document that will be attached to an individual record for a File Upload field. Please note that this method may NOT be used for Signature fields (i.e. File Upload fields with 'signature' validation type) because a signature can only be captured and stored using the web interface. + ///
+ /// + /// To use this method, you must have API Import/Update privileges in the project. + /// If you pass in a record parameter that does not exist, Redcap will create it for you. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// the record ID + /// the name of the field that contains the file + /// the unique event name - only for longitudinal projects + /// (only for projects with repeating instruments/events) The repeat instance number of the repeating event (if longitudinal) or the repeating instrument (if classic or longitudinal). Default value is '1'. + /// The File you be imported, contents of the file + /// the path where the file is located + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'xml'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + + Task ImportFileAsync(string token, string record, string field, string eventName, string repeatInstance, string fileName, string filePath, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + /// + /// Import a File

+ /// This method allows you to upload a document that will be attached to an individual record for a File Upload field. Please note that this method may NOT be used for Signature fields (i.e. File Upload fields with 'signature' validation type) because a signature can only be captured and stored using the web interface. + ///
+ /// + /// To use this method, you must have API Import/Update privileges in the project. + /// If you pass in a record parameter that does not exist, Redcap will create it for you. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// file + /// import + /// the record ID + /// the name of the field that contains the file + /// the unique event name - only for longitudinal projects + /// (only for projects with repeating instruments/events) The repeat instance number of the repeating event (if longitudinal) or the repeating instrument (if classic or longitudinal). Default value is '1'. + /// The File you be imported, contents of the file + /// the path where the file is located + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'xml'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + + Task ImportFileAsync(string token, Content content, RedcapAction action, string record, string field, string eventName, string repeatInstance, string fileName, string filePath, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + /// + /// Delete a File

+ /// This method allows you to remove a document that has been attached to an individual record for a File Upload field. Please note that this method may also be used for Signature fields (i.e. File Upload fields with 'signature' validation type). + ///
+ /// + /// To use this method, you must have API Import/Update privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// the record ID + /// the name of the field that contains the file + /// the unique event name - only for longitudinal projects + /// (only for projects with repeating instruments/events) The repeat instance number of the repeating event (if longitudinal) or the repeating instrument (if classic or longitudinal). Default value is '1'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// String + + Task DeleteFileAsync(string token, string record, string field, string eventName, string repeatInstance, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + /// + /// Delete a File

+ /// This method allows you to remove a document that has been attached to an individual record for a File Upload field. Please note that this method may also be used for Signature fields (i.e. File Upload fields with 'signature' validation type). + ///
+ /// + /// To use this method, you must have API Import/Update privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// file + /// delete + /// the record ID + /// the name of the field that contains the file + /// the unique event name - only for longitudinal projects + /// (only for projects with repeating instruments/events) The repeat instance number of the repeating event (if longitudinal) or the repeating instrument (if classic or longitudinal). Default value is '1'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// String + Task DeleteFileAsync(string token, Content content, RedcapAction action, string record, string field, string eventName, string repeatInstance, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); - Task DeleteFileAsync(string token, Content content, RedcapAction action, string record, string field, string eventName, string repeatInstance, OnErrorFormat returnFormat = OnErrorFormat.json); - Task DeleteFileAsync(string token, string record, string field, string eventName, string repeatInstance, OnErrorFormat returnFormat = OnErrorFormat.json); #endregion #region File Repository + /// + /// From Redcap Version 13.1

+ /// + /// Create a New Folder in the File Repository

+ /// + /// This method allows you to create a new folder in the File Repository.
+ /// You may optionally provide the folder_id of the parent folder under which you wish this folder to be created.
+ /// Providing a dag_id and/or role_id will allow you to restrict access to only users within a specific DAG (Data Access Group) or User Role, respectively. + /// + ///
+ /// + /// + /// To use this method, you must have API Import/Update privileges and File Repository privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// fileRepository + /// createFolder + /// The desired name of the folder to be created (max length = 150 characters) + /// csv, json [default], xml + /// the folder_id of a specific folder in the File Repository for which you wish to create this sub-folder. If none is provided, the folder will be created in the top-level directory of the File Repository. + /// the dag_id of the DAG (Data Access Group) to which you wish to restrict access for this folder. If none is provided, the folder will accessible to users in all DAGs and users in no DAGs. + /// the role_id of the User Role to which you wish to restrict access for this folder. If none is provided, the folder will accessible to users in all User Roles and users in no User Roles. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// + /// The folder_id of the new folder created in the specified format.
For example, if using format=json, the output would look similar to this: [{folder_id:45}].
Task CreateFolderFileRepositoryAsync(string token, Content content = Content.FileRepository, RedcapAction action = RedcapAction.CreateFolder, string name = null, RedcapFormat format = RedcapFormat.json, string folderId = null, string dagId = null, string roleId = null, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); - Task ExportFilesFoldersFileRepositoryAsync(string token, Content content = Content.FileRepository, RedcapAction action = RedcapAction.List, RedcapFormat format = RedcapFormat.json, string folderId = null, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + + /// + /// From Redcap Version 13.1
+ /// + /// Export a List of Files/Folders from the File Repository

+ /// + ///
+ /// + /// To use this method, you must have API Export privileges and File Repository privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// fileRepository + /// list + /// csv, json [default], xml + /// the folder_id of a specific folder in the File Repository for which you wish to export a list of its files and sub-folders. If none is provided, the top-level directory of the File Repository will be used. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// The list of all files and folders within a given sub-folder in the File Repository in the format specified. + Task ExportFilesFoldersFileRepositoryAsync(string token, Content content, RedcapAction action, RedcapFormat format, string folderId = default, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + + /// + /// From Redcap Version 13.1
+ /// Export a File from the File Repository
+ ///
+ /// + /// To use this method, you must have API Export privileges and File Repository privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// fileRepository + /// export + /// the doc_id of the file in the File Repository + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// the contents of the file Task ExportFileFileRepositoryAsync(string token, Content content = Content.FileRepository, RedcapAction action = RedcapAction.Export, string docId = null, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); - Task ImportFileRepositoryAsync(string token, Content content = Content.FileRepository, RedcapAction action = RedcapAction.Import, string file = null, string folderId = null, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); - Task DeleteFileRepositoryAsync(string token, Content content = Content.FileRepository, RedcapAction action = RedcapAction.Delete, string docId = null, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + + /// + /// From Redcap Version 13.1
+ /// Import a File into the File Repository
+ /// + ///
+ /// + /// To use this method, you must have API Import/Update privileges and File Repository privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// fileRepository + /// import + /// the contents of the file + /// the folder_id of a specific folder in the File Repository where you wish to store the file. If none is provided, the file will be stored in the top-level directory of the File Repository. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// string + Task ImportFileRepositoryAsync(string token, Content content, RedcapAction action, string file, string folderId = default, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + + /// + /// From Redcap Version 13.1
+ /// Delete a File from the File Repository
+ /// + ///
+ /// + /// To use this method, you must have API Import/Update privileges and File Repository privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// fileRepository + /// delete + /// the doc_id of the file in the File Repository + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// string + Task DeleteFileRepositoryAsync(string token, Content content, RedcapAction action, string docId, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); #endregion File Repository #region Instruments - Task ExportInstrumentsAsync(string token, Content content = Content.Instrument, ReturnFormat inputFormat = ReturnFormat.json); - Task ExportInstrumentsAsync(string token, ReturnFormat inputFormat = ReturnFormat.json); - - Task ExportPDFInstrumentsAsync(string token, Content content = Content.Pdf, string recordId = null, string eventName = null, string instrument = null, bool allRecord = false, bool compactDisplay = false, OnErrorFormat returnFormat = OnErrorFormat.json); - Task ExportPDFInstrumentsAsync(string token, string recordId = null, string eventName = null, string instrument = null, bool allRecord = false, OnErrorFormat returnFormat = OnErrorFormat.json); - Task ExportInstrumentMappingAsync(string token, Content content = Content.FormEventMapping, ReturnFormat inputFormat = ReturnFormat.json, string[] arms = null, OnErrorFormat returnFormat = OnErrorFormat.json); - Task ExportInstrumentMappingAsync(string token, ReturnFormat inputFormat = ReturnFormat.json, string[] arms = null, OnErrorFormat returnFormat = OnErrorFormat.json); + /// + /// Export Instruments (Data Entry Forms)

+ /// This method allows you to export a list of the data collection instruments for a project. + /// This includes their unique instrument name as seen in the second column of the Data Dictionary, as well as each instrument's corresponding instrument label, which is seen on a project's left-hand menu when entering data. The instruments will be ordered according to their order in the project. + ///
+ /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// csv, json [default], xml + /// Instruments for the project in the format specified and will be ordered according to their order in the project. + Task ExportInstrumentsAsync(string token, RedcapFormat format = RedcapFormat.json); + /// + /// Export Instruments (Data Entry Forms)
+ /// This method allows you to export a list of the data collection instruments for a project. + /// This includes their unique instrument name as seen in the second column of the Data Dictionary, as well as each instrument's corresponding instrument label, which is seen on a project's left-hand menu when entering data. The instruments will be ordered according to their order in the project. + ///
+ /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// instrument + /// csv, json [default], xml + /// Instruments for the project in the format specified and will be ordered according to their order in the project. + Task ExportInstrumentsAsync(string token, Content content = Content.Instrument, RedcapFormat format = RedcapFormat.json); + /// + /// From Redcap Version 6.4.0

+ /// Export PDF file of Data Collection Instruments (either as blank or with data)

+ /// This method allows you to export a PDF file for any of the following: 1) a single data collection instrument (blank), 2) all instruments (blank), 3) a single instrument (with data from a single record), 4) all instruments (with data from a single record), or 5) all instruments (with data from ALL records). + /// This is the exact same PDF file that is downloadable from a project's data entry form in the web interface, and additionally, the user's privileges with regard to data exports will be applied here just like they are when downloading the PDF in the web interface (e.g., if they have de-identified data export rights, then it will remove data from certain fields in the PDF). + /// If the user has 'No Access' data export rights, they will not be able to use this method, and an error will be returned. + ///
+ /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// the record ID. The value is blank by default. If record is blank, it will return the PDF as blank (i.e. with no data). If record is provided, it will return a single instrument or all instruments containing data from that record only. + /// the unique event name - only for longitudinal projects. For a longitudinal project, if record is not blank and event is blank, it will return data for all events from that record. If record is not blank and event is not blank, it will return data only for the specified event from that record. + /// the unique instrument name as seen in the second column of the Data Dictionary. The value is blank by default, which returns all instruments. If record is not blank and instrument is blank, it will return all instruments for that record. + /// [The value of this parameter does not matter and is ignored.] If this parameter is passed with any value, it will export all instruments (and all events, if longitudinal) with data from all records. Note: If this parameter is passed, the parameters record, event, and instrument will be ignored. + /// csv, json [default] , xml- The returnFormat is only used with regard to the format of any error messages that might be returned. + /// A PDF file containing one or all data collection instruments from the project, in which the instruments will be blank (no data), contain data from a single record, or contain data from all records in the project, depending on the parameters passed in the API request. + Task ExportPDFInstrumentsAsync(string token, string recordId = null, string eventName = null, string instrument = null, bool allRecord = false, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + /// + /// From Redcap Version 11.4.4

+ /// Export PDF file of Data Collection Instruments (either as blank or with data)

+ /// This method allows you to export a PDF file for any of the following: 1) a single data collection instrument (blank), 2) all instruments (blank), 3) a single instrument (with data from a single record), 4) all instruments (with data from a single record), or 5) all instruments (with data from ALL records). + /// This is the exact same PDF file that is downloadable from a project's data entry form in the web interface, and additionally, the user's privileges with regard to data exports will be applied here just like they are when downloading the PDF in the web interface (e.g., if they have de-identified data export rights, then it will remove data from certain fields in the PDF). + /// If the user has 'No Access' data export rights, they will not be able to use this method, and an error will be returned. + ///
+ /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// pdf + /// the record ID. The value is blank by default. If record is blank, it will return the PDF as blank (i.e. with no data). If record is provided, it will return a single instrument or all instruments containing data from that record only. + /// the unique event name - only for longitudinal projects. For a longitudinal project, if record is not blank and event is blank, it will return data for all events from that record. If record is not blank and event is not blank, it will return data only for the specified event from that record. + /// the unique instrument name as seen in the second column of the Data Dictionary. The value is blank by default, which returns all instruments. If record is not blank and instrument is blank, it will return all instruments for that record. + /// [The value of this parameter does not matter and is ignored.] If this parameter is passed with any value, it will export all instruments (and all events, if longitudinal) with data from all records. Note: If this parameter is passed, the parameters record, event, and instrument will be ignored. + /// Set to TRUE to return a compact-formatted PDF that excludes fields that have no data saved and excludes unselected multiple choice options, thus producing a smaller PDF file. If set to FALSE, all fields will be displayed normally. + /// csv, json [default] , xml- The returnFormat is only used with regard to the format of any error messages that might be returned. + /// A PDF file containing one or all data collection instruments from the project, in which the instruments will be blank (no data), contain data from a single record, or contain data from all records in the project, depending on the parameters passed in the API request. + Task ExportPDFInstrumentsAsync(string token, Content content = Content.Pdf, string recordId = null, string eventName = null, string instrument = null, bool allRecords = false, bool compactDisplay = false, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + /// + /// From Redcap Version 4.7.0

+ /// + /// Export Instrument-Event Mappings

+ /// This method allows you to export the instrument-event mappings for a project (i.e., how the data collection instruments are designated for certain events in a longitudinal project). + /// NOTE: This only works for longitudinal projects. + ///
+ /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// csv, json [default], xml + /// an array of arm numbers that you wish to pull events for (by default, all events are pulled) + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// Instrument-event mappings for the project in the format specified + Task ExportInstrumentMappingAsync(string token, RedcapFormat format = RedcapFormat.json, string[] arms = null, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + /// + /// From Redcap Version 4.7.0

+ /// + /// Export Instrument-Event Mappings

+ /// This method allows you to export the instrument-event mappings for a project (i.e., how the data collection instruments are designated for certain events in a longitudinal project). + /// NOTE: This only works for longitudinal projects. + ///
+ /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// formEventMapping + /// csv, json [default], xml + /// an array of arm numbers that you wish to pull events for (by default, all events are pulled) + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// Instrument-event mappings for the project in the format specified + Task ExportInstrumentMappingAsync(string token, Content content, RedcapFormat format, string[] arms = default, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); - Task ImportInstrumentMappingAsync(string token, Content content, ReturnFormat inputFormat, List data, OnErrorFormat returnFormat = OnErrorFormat.json); - Task ImportInstrumentMappingAsync(string token, ReturnFormat inputFormat, List data, OnErrorFormat returnFormat = OnErrorFormat.json); + /// + /// FFrom Redcap Version 4.7.0

+ /// + /// Import Instrument-Event Mappings

+ /// This method allows you to import Instrument-Event Mappings into a project (this corresponds to the 'Designate Instruments for My Events' page in the project). + /// NOTE: This only works for longitudinal projects. + ///
+ /// + /// To use this method, you must have API Import/Update privileges *and* Project Design/Setup privileges in the project. + /// + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// csv, json [default], xml + /// Contains the attributes 'arm_num' (referring to the arm number), 'unique_event_name' (referring to the auto-generated unique event name of the given event), and 'form' (referring to the unique form name of the given data collection instrument), in which they are provided in the specified format. + /// JSON Example:[{"arm_num":"1","unique_event_name":"baseline_arm_1","form":"demographics"}, + /// {"arm_num":"1","unique_event_name":"visit_1_arm_1","form":"day_3"}, + /// {"arm_num":"1","unique_event_name":"visit_1_arm_1","form":"other"}, + /// {"arm_num":"1","unique_event_name":"visit_2_arm_1","form":"other"}] + /// + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// Number of Instrument-Event Mappings imported + Task ImportInstrumentMappingAsync(string token, RedcapFormat format, List data, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + /// + /// From Redcap Version 4.7.0

+ /// + /// Import Instrument-Event Mappings

+ /// This method allows you to import Instrument-Event Mappings into a project (this corresponds to the 'Designate Instruments for My Events' page in the project). + /// NOTE: This only works for longitudinal projects. + ///
+ /// + /// To use this method, you must have API Import/Update privileges *and* Project Design/Setup privileges in the project. + /// + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// formEventMapping + /// csv, json [default], xml + /// Contains the attributes 'arm_num' (referring to the arm number), 'unique_event_name' (referring to the auto-generated unique event name of the given event), and 'form' (referring to the unique form name of the given data collection instrument), in which they are provided in the specified format. + /// JSON Example:[{"arm_num":"1","unique_event_name":"baseline_arm_1","form":"demographics"}, + /// {"arm_num":"1","unique_event_name":"visit_1_arm_1","form":"day_3"}, + /// {"arm_num":"1","unique_event_name":"visit_1_arm_1","form":"other"}, + /// {"arm_num":"1","unique_event_name":"visit_2_arm_1","form":"other"}] + /// + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// Number of Instrument-Event Mappings imported + Task ImportInstrumentMappingAsync(string token, Content content, RedcapFormat format, List data, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); #endregion #region Logging - Task ExportLoggingAsync(string token, Content content, ReturnFormat format = ReturnFormat.json, LogType logType = LogType.All, string user = null, string record = null, string dag = null, string beginTime = null, string endTime = null, OnErrorFormat onErrorFormat = OnErrorFormat.json); + /// + /// From Redcap Version 10.8
+ /// Export Logging
+ /// This method allows you to export the logging (audit trail) of all changes made to this project, including data exports, data changes, project metadata changes, modification of user rights, etc. + ///
KEY:
Filter by event (logtype):
export = Data export,
manage = Manage/Design,
user = User or role created-updated-deleted,
record = Record created-updated-deleted,
record_add = Record created (only),
record_edit = Record updated(only),
record_delete = Record deleted(only),
lock_record = Record locking and e-signatures,
page_view = Page View + ///
+ /// + /// To use this method, you must have API Export privileges *and* Logging privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// log + /// csv, json [default], xml + /// You may choose event type to fetch result for specific event type + /// To return only the events belong to specific user (referring to existing username), provide a user. If not specified, it will assume all users + /// To return only the events belong to specific record (referring to existing record name), provide a record. If not specified, it will assume all records. This parameter is available only when event is related to record. + /// To return only the events belong to specific DAG (referring to group_id), provide a dag. If not specified, it will assume all dags. + /// To return only the events that have been logged *after* a given date/time, provide a timestamp in the format YYYY-MM-DD HH:MM (e.g., '2017-01-01 17:00' for January 1, 2017 at 5:00 PM server time). If not specified, it will assume no begin time. + /// To return only records that have been logged *before* a given date/time, provide a timestamp in the format YYYY-MM-DD HH:MM (e.g., '2017-01-01 17:00' for January 1, 2017 at 5:00 PM server time). If not specified, it will use the current server time. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// List of all changes made to this project, including data exports, data changes, and the creation or deletion of users. + Task ExportLoggingAsync(string token, Content content, RedcapFormat format = RedcapFormat.json, LogType logType = LogType.All, string user = default, string record = default, string dag = default, string beginTime = default, string endTime = default, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); #endregion #region Metadata - Task ExportMetaDataAsync(string token, Content content, ReturnFormat inputFormat, string[] fields = null, string[] forms = null, OnErrorFormat returnFormat = OnErrorFormat.json); - Task ExportMetaDataAsync(string token, ReturnFormat inputFormat, string[] fields = null, string[] forms = null, OnErrorFormat returnFormat = OnErrorFormat.json); + /// + /// From Redcap Version 3.4.0+

+ /// Export Metadata (Data Dictionary) + /// This method allows you to export the metadata for a project + ///
+ /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// csv, json [default], xml + /// an array of field names specifying specific fields you wish to pull (by default, all metadata is pulled) + /// an array of form names specifying specific data collection instruments for which you wish to pull metadata (by default, all metadata is pulled). NOTE: These 'forms' are not the form label values that are seen on the webpages, but instead they are the unique form names seen in Column B of the data dictionary. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// Metadata from the project (i.e. Data Dictionary values) in the format specified ordered by the field order + Task ExportMetaDataAsync(string token, RedcapFormat format, string[] fields = default, string[] forms = default, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + /// + /// From Redcap Version 3.4.0+

+ /// Export Metadata (Data Dictionary)
+ /// This method allows you to export the metadata for a project + ///
+ /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// metadata + /// csv, json [default], xml + /// an array of field names specifying specific fields you wish to pull (by default, all metadata is pulled) + /// an array of form names specifying specific data collection instruments for which you wish to pull metadata (by default, all metadata is pulled). NOTE: These 'forms' are not the form label values that are seen on the webpages, but instead they are the unique form names seen in Column B of the data dictionary. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// Metadata from the project (i.e. Data Dictionary values) in the format specified ordered by the field order + Task ExportMetaDataAsync(string token, Content content, RedcapFormat format, string[] fields = default, string[] forms = default, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); - Task ImportMetaDataAsync(string token, Content content, ReturnFormat inputFormat, List data, OnErrorFormat returnFormat = OnErrorFormat.json); - Task ImportMetaDataAsync(string token, ReturnFormat inputFormat, List data, OnErrorFormat returnFormat = OnErrorFormat.json); + /// + /// From Redcap Version 6.11.0

+ /// + /// Import Metadata (Data Dictionary)

+ /// + /// This method allows you to import metadata (i.e., Data Dictionary) into a project. Notice: Because of this method's destructive nature, it is only available for use for projects in Development status. + ///
+ /// + /// To use this method, you must have API Import/Update privileges *and* Project Design/Setup privileges in the project. + /// + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// csv, json [default], xml + /// The formatted data to be imported. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// Number of fields imported + + Task ImportMetaDataAsync(string token, RedcapFormat format, List data, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + /// + /// From Redcap Version 6.11.0

+ /// + /// Import Metadata (Data Dictionary)

+ /// + /// This method allows you to import metadata (i.e., Data Dictionary) into a project. Notice: Because of this method's destructive nature, it is only available for use for projects in Development status. + ///
+ /// + /// To use this method, you must have API Import/Update privileges *and* Project Design/Setup privileges in the project. + /// + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// metadata + /// csv, json [default], xml + /// The formatted data to be imported. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// Number of fields imported + Task ImportMetaDataAsync(string token, Content content, RedcapFormat format, List data, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); #endregion #region Projects - Task CreateProjectAsync(string token, Content content, ReturnFormat inputFormat, List data, OnErrorFormat returnFormat = OnErrorFormat.json, string odm = null); - Task CreateProjectAsync(string token, ReturnFormat inputFormat, List data, OnErrorFormat returnFormat = OnErrorFormat.json, string odm = null); + /// + /// From Redcap Version 6.11.0

+ /// + /// Create A New Project
+ /// + /// This method allows you to create a new REDCap project. A 64-character Super API Token is required for this method (as opposed to project-level API methods that require a regular 32-character token associated with the project-user). In the API request, you must minimally provide the project attributes 'project_title' and 'purpose' (with numerical value 0=Practice/Just for fun, 1=Other, 2=Research, 3=Quality Improvement, 4=Operational Support) when creating a project. + /// When a project is created with this method, the project will automatically be given all the project-level defaults just as if you created a new empty project via the web user interface, such as a automatically creating a single data collection instrument seeded with a single Record ID field and Form Status field, as well as (for longitudinal projects) one arm with one event. And if you intend to create your own arms or events immediately after creating the project, it is recommended that you utilize the override=1 parameter in the 'Import Arms' or 'Import Events' method, respectively, so that the default arm and event are removed when you add your own.Also, the user creating the project will automatically be added to the project as a user with full user privileges and a project-level API token, which could then be used for subsequent project-level API requests. + /// NOTE: Only users with Super API Tokens can utilize this method.Users can only be granted a super token by a REDCap administrator(using the API Tokens page in the REDCap Control Center). Please be advised that users with a Super API Token can create new REDCap projects via the API without any approval needed by a REDCap administrator.If you are interested in obtaining a super token, please contact your local REDCap administrator. + ///
+ /// + /// To use this method, you must have a Super API Token. + /// + /// + /// The Super API Token specific to a user + /// csv, json [default], xml + /// + /// Contains the attributes of the project to be created, in which they are provided in the specified format. While the only required attributes are 'project_title' and 'purpose', the fields listed below are all the possible attributes that can be provided in the 'data' parameter. The 'purpose' attribute must have a numerical value (0=Practice/Just for fun, 1=Other, 2=Research, 3=Quality Improvement, 4=Operational Support), in which 'purpose_other' is only required to have a value (as a text string) if purpose=1. The attributes is_longitudinal (0=False, 1=True; Default=0), surveys_enabled (0=False, 1=True; Default=0), and record_autonumbering_enabled (0=False, 1=True; Default=1) are all boolean. Please note that either is_longitudinal=1 or surveys_enabled=1 does not add arms/events or surveys to the project, respectively, but it merely enables those settings which are seen at the top of the project's Project Setup page. + /// All available attributes: + /// project_title, purpose, purpose_other, project_notes, is_longitudinal, surveys_enabled, record_autonumbering_enabled + /// JSON Example: + /// [{"project_title":"My New REDCap Project","purpose":"0"}] + /// + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// default: NULL - The 'odm' parameter must be an XML string in CDISC ODM XML format that contains project metadata (fields, forms, events, arms) and might optionally contain data to be imported as well. The XML contained in this parameter can come from a REDCap Project XML export file from REDCap itself, or may come from another system that is capable of exporting projects and data in CDISC ODM format. If the 'odm' parameter is included in the API request, it will use the XML to import its contents into the newly created project. This will allow you not only to create the project with the API request, but also to import all fields, forms, and project attributes (and events and arms, if longitudinal) as well as record data all at the same time. + /// When a project is created, a 32-character project-level API Token is returned (associated with both the project and user creating the project). This token could then ostensibly be used to make subsequent API calls to this project, such as for adding new events, fields, records, etc. + Task CreateProjectAsync(string token, RedcapFormat format, List data, RedcapReturnFormat returnFormat = RedcapReturnFormat.json, string odm = null); + /// + /// From Redcap Version 6.11.0

+ /// + /// Create A New Project
+ /// + /// This method allows you to create a new REDCap project. A 64-character Super API Token is required for this method (as opposed to project-level API methods that require a regular 32-character token associated with the project-user). In the API request, you must minimally provide the project attributes 'project_title' and 'purpose' (with numerical value 0=Practice/Just for fun, 1=Other, 2=Research, 3=Quality Improvement, 4=Operational Support) when creating a project. + /// When a project is created with this method, the project will automatically be given all the project-level defaults just as if you created a new empty project via the web user interface, such as a automatically creating a single data collection instrument seeded with a single Record ID field and Form Status field, as well as (for longitudinal projects) one arm with one event. And if you intend to create your own arms or events immediately after creating the project, it is recommended that you utilize the override=1 parameter in the 'Import Arms' or 'Import Events' method, respectively, so that the default arm and event are removed when you add your own.Also, the user creating the project will automatically be added to the project as a user with full user privileges and a project-level API token, which could then be used for subsequent project-level API requests. + /// NOTE: Only users with Super API Tokens can utilize this method.Users can only be granted a super token by a REDCap administrator(using the API Tokens page in the REDCap Control Center). Please be advised that users with a Super API Token can create new REDCap projects via the API without any approval needed by a REDCap administrator.If you are interested in obtaining a super token, please contact your local REDCap administrator. + ///
+ /// + /// To use this method, you must have a Super API Token. + /// + /// To use this method, you must have a Super API Token. + /// + /// The Super API Token specific to a user + /// project + /// csv, json [default], xml + /// + /// Contains the attributes of the project to be created, in which they are provided in the specified format. While the only required attributes are 'project_title' and 'purpose', the fields listed below are all the possible attributes that can be provided in the 'data' parameter. The 'purpose' attribute must have a numerical value (0=Practice/Just for fun, 1=Other, 2=Research, 3=Quality Improvement, 4=Operational Support), in which 'purpose_other' is only required to have a value (as a text string) if purpose=1. The attributes is_longitudinal (0=False, 1=True; Default=0), surveys_enabled (0=False, 1=True; Default=0), and record_autonumbering_enabled (0=False, 1=True; Default=1) are all boolean. Please note that either is_longitudinal=1 or surveys_enabled=1 does not add arms/events or surveys to the project, respectively, but it merely enables those settings which are seen at the top of the project's Project Setup page. + /// All available attributes: + /// project_title, purpose, purpose_other, project_notes, is_longitudinal, surveys_enabled, record_autonumbering_enabled + /// JSON Example: + /// [{"project_title":"My New REDCap Project","purpose":"0"}] + /// + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// default: NULL - The 'odm' parameter must be an XML string in CDISC ODM XML format that contains project metadata (fields, forms, events, arms) and might optionally contain data to be imported as well. The XML contained in this parameter can come from a REDCap Project XML export file from REDCap itself, or may come from another system that is capable of exporting projects and data in CDISC ODM format. If the 'odm' parameter is included in the API request, it will use the XML to import its contents into the newly created project. This will allow you not only to create the project with the API request, but also to import all fields, forms, and project attributes (and events and arms, if longitudinal) as well as record data all at the same time. + /// When a project is created, a 32-character project-level API Token is returned (associated with both the project and user creating the project). This token could then ostensibly be used to make subsequent API calls to this project, such as for adding new events, fields, records, etc. + + Task CreateProjectAsync(string token, Content content, RedcapFormat format, List data, RedcapReturnFormat returnFormat = RedcapReturnFormat.json, string odm = null); + /// + /// Import Project Information

+ /// This method allows you to update some of the basic attributes of a given REDCap project, such as the project's title, if it is longitudinal, if surveys are enabled, etc. Its data format corresponds to the format in the API method Export Project Information. + ///
+ /// + /// To use this method, you must have API Import/Update privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// project_settings + /// csv, json [default], xml + /// Contains some or all of the attributes from Export Project Information in the same data format as in the export. These attributes will change the project information. + /// Attributes for the project in the format specified. For any values that are boolean, they should be represented as either a '0' (no/false) or '1' (yes/true). The following project attributes can be udpated: + /// project_title, project_language, purpose, purpose_other, project_notes, custom_record_label, secondary_unique_field, is_longitudinal, surveys_enabled, scheduling_enabled, record_autonumbering_enabled, randomization_enabled, project_irb_number, project_grant_number, project_pi_firstname, project_pi_lastname, display_today_now_button + /// + /// Returns the number of values accepted to be updated in the project settings (including values which remained the same before and after the import). - Task ImportProjectInfoAsync(string token, Content content, ReturnFormat inputFormat, RedcapProjectInfo projectInfo); - Task ImportProjectInfoAsync(string token, ReturnFormat inputFormat, RedcapProjectInfo projectInfo); + Task ImportProjectInfoAsync(string token, Content content, RedcapFormat format, RedcapProjectInfo projectInfo); + /// + /// Import Project Information

+ /// This method allows you to update some of the basic attributes of a given REDCap project, such as the project's title, if it is longitudinal, if surveys are enabled, etc. Its data format corresponds to the format in the API method Export Project Information. + ///
+ /// + /// To use this method, you must have API Import/Update privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// csv, json [default], xml + /// Contains some or all of the attributes from Export Project Information in the same data format as in the export. These attributes will change the project information. + /// Attributes for the project in the format specified. For any values that are boolean, they should be represented as either a '0' (no/false) or '1' (yes/true). The following project attributes can be udpated: + /// project_title, project_language, purpose, purpose_other, project_notes, custom_record_label, secondary_unique_field, is_longitudinal, surveys_enabled, scheduling_enabled, record_autonumbering_enabled, randomization_enabled, project_irb_number, project_grant_number, project_pi_firstname, project_pi_lastname, display_today_now_button + /// + /// Returns the number of values accepted to be updated in the project settings (including values which remained the same before and after the import). + Task ImportProjectInfoAsync(string token, RedcapFormat format, RedcapProjectInfo projectInfo); + /// + /// Export Project Information

+ /// This method allows you to export some of the basic attributes of a given REDCap project, such as the project's title, if it is longitudinal, if surveys are enabled, the time the project was created and moved to production, etc. + ///
+ /// + /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// project + /// csv, json [default], xml + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// + /// Attributes for the project in the format specified. For any values that are boolean, they will be represented as either a '0' (no/false) or '1' (yes/true). Also, all date/time values will be returned in Y-M-D H:M:S format. The following attributes will be returned: + /// project_id, project_title, creation_time, production_time, in_production, project_language, purpose, purpose_other, project_notes, custom_record_label, secondary_unique_field, is_longitudinal, surveys_enabled, scheduling_enabled, record_autonumbering_enabled, randomization_enabled, ddp_enabled, project_irb_number, project_grant_number, project_pi_firstname, project_pi_lastname, display_today_now_button + /// - Task ExportProjectInfoAsync(string token, Content content = Content.Project, ReturnFormat inputFormat = ReturnFormat.json, OnErrorFormat returnFormat = OnErrorFormat.json); - Task ExportProjectInfoAsync(string token, ReturnFormat inputFormat = ReturnFormat.json, OnErrorFormat returnFormat = OnErrorFormat.json); + Task ExportProjectInfoAsync(string token, Content content = Content.Project, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + /// + /// Export Project Information

+ /// This method allows you to export some of the basic attributes of a given REDCap project, such as the project's title, if it is longitudinal, if surveys are enabled, the time the project was created and moved to production, etc. + ///
+ /// + /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// csv, json [default], xml + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// + /// Attributes for the project in the format specified. For any values that are boolean, they will be represented as either a '0' (no/false) or '1' (yes/true). Also, all date/time values will be returned in Y-M-D H:M:S format. The following attributes will be returned: + /// project_id, project_title, creation_time, production_time, in_production, project_language, purpose, purpose_other, project_notes, custom_record_label, secondary_unique_field, is_longitudinal, surveys_enabled, scheduling_enabled, record_autonumbering_enabled, randomization_enabled, ddp_enabled, project_irb_number, project_grant_number, project_pi_firstname, project_pi_lastname, display_today_now_button + /// + Task ExportProjectInfoAsync(string token, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + /// + /// From Redcap Version 6.12.0

+ /// + /// Export Entire Project as REDCap XML File (containing metadata and data)
+ /// The entire project(all records, events, arms, instruments, fields, and project attributes) can be downloaded as a single XML file, which is in CDISC ODM format(ODM version 1.3.1). This XML file can be used to create a clone of the project(including its data, optionally) on this REDCap server or on another REDCap server (it can be uploaded on the Create New Project page). Because it is in CDISC ODM format, it can also be used to import the project into another ODM-compatible system. NOTE: All the option paramters listed below ONLY apply to data returned if the 'returnMetadataOnly' parameter is set to FALSE (default). For this API method, ALL metadata (all fields, forms, events, and arms) will always be exported.Only the data returned can be filtered using the optional parameters. + /// Note about export rights: If the 'returnMetadataOnly' parameter is set to FALSE, then please be aware that Data Export user rights will be applied to any data returned from this API request. For example, if you have 'De-Identified' or 'Remove all tagged Identifier fields' data export rights, then some data fields *might* be removed and filtered out of the data set returned from the API. To make sure that no data is unnecessarily filtered out of your API request, you should have 'Full Data Set' export rights in the project. + ///
+ /// + /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// project_xml + /// true, false [default] - TRUE returns only metadata (all fields, forms, events, and arms), whereas FALSE returns all metadata and also data (and optionally filters the data according to any of the optional parameters provided in the request) + /// an array of record names specifying specific records you wish to pull (by default, all records are pulled) + /// an array of field names specifying specific fields you wish to pull (by default, all fields are pulled) + /// an array of unique event names that you wish to pull records for - only for longitudinal projects + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// true, false [default] - specifies whether or not to export the survey identifier field (e.g., 'redcap_survey_identifier') or survey timestamp fields (e.g., instrument+'_timestamp') when surveys are utilized in the project. If you do not pass in this flag, it will default to 'false'. If set to 'true', it will return the redcap_survey_identifier field and also the survey timestamp field for a particular survey when at least one field from that survey is being exported. NOTE: If the survey identifier field or survey timestamp fields are imported via API data import, they will simply be ignored since they are not real fields in the project but rather are pseudo-fields. + /// true, false [default] - specifies whether or not to export the 'redcap_data_access_group' field when data access groups are utilized in the project. If you do not pass in this flag, it will default to 'false'. NOTE: This flag is only viable if the user whose token is being used to make the API request is *not* in a data access group. If the user is in a group, then this flag will revert to its default value. + /// String of logic text (e.g., [age] > 30) for filtering the data to be returned by this API method, in which the API will only return the records (or record-events, if a longitudinal project) where the logic evaluates as TRUE. This parameter is blank/null by default unless a value is supplied. Please note that if the filter logic contains any incorrect syntax, the API will respond with an error message. + /// true, false [default] - TRUE will cause the XML returned to include all files uploaded for File Upload and Signature fields for all records in the project, whereas FALSE will cause all such fields not to be included. NOTE: Setting this option to TRUE can make the export very large and may prevent it from completing if the project contains many files or very large files. + /// The entire REDCap project's metadata (and data, if specified) will be returned in CDISC ODM format as a single XML string. - Task ExportProjectXmlAsync(string token, Content content = Content.MetaData, bool returnMetadataOnly = false, string[] records = null, string[] fields = null, string[] events = null, OnErrorFormat returnFormat = OnErrorFormat.json, bool exportSurveyFields = false, bool exportDataAccessGroups = false, string filterLogic = null, bool exportFiles = false); - Task ExportProjectXmlAsync(string token, bool returnMetadataOnly = false, string[] records = null, string[] fields = null, string[] events = null, OnErrorFormat returnFormat = OnErrorFormat.json, bool exportSurveyFields = false, bool exportDataAccessGroups = false, string filterLogic = null, bool exportFiles = false); + Task ExportProjectXmlAsync(string token, Content content = Content.MetaData, bool returnMetadataOnly = false, string[] records = null, string[] fields = null, string[] events = null, RedcapReturnFormat returnFormat = RedcapReturnFormat.json, bool exportSurveyFields = false, bool exportDataAccessGroups = false, string filterLogic = null, bool exportFiles = false); + /// + /// From Redcap Version 6.12.0
+ /// + /// Export Entire Project as REDCap XML File (containing metadata and data)
+ /// The entire project(all records, events, arms, instruments, fields, and project attributes) can be downloaded as a single XML file, which is in CDISC ODM format(ODM version 1.3.1). This XML file can be used to create a clone of the project(including its data, optionally) on this REDCap server or on another REDCap server (it can be uploaded on the Create New Project page). Because it is in CDISC ODM format, it can also be used to import the project into another ODM-compatible system. NOTE: All the option paramters listed below ONLY apply to data returned if the 'returnMetadataOnly' parameter is set to FALSE (default). For this API method, ALL metadata (all fields, forms, events, and arms) will always be exported.Only the data returned can be filtered using the optional parameters. + /// Note about export rights: If the 'returnMetadataOnly' parameter is set to FALSE, then please be aware that Data Export user rights will be applied to any data returned from this API request. For example, if you have 'De-Identified' or 'Remove all tagged Identifier fields' data export rights, then some data fields *might* be removed and filtered out of the data set returned from the API. To make sure that no data is unnecessarily filtered out of your API request, you should have 'Full Data Set' export rights in the project. + ///
+ /// + /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// true, false [default] - TRUE returns only metadata (all fields, forms, events, and arms), whereas FALSE returns all metadata and also data (and optionally filters the data according to any of the optional parameters provided in the request) + /// an array of record names specifying specific records you wish to pull (by default, all records are pulled) + /// an array of field names specifying specific fields you wish to pull (by default, all fields are pulled) + /// an array of unique event names that you wish to pull records for - only for longitudinal projects + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// true, false [default] - specifies whether or not to export the survey identifier field (e.g., 'redcap_survey_identifier') or survey timestamp fields (e.g., instrument+'_timestamp') when surveys are utilized in the project. If you do not pass in this flag, it will default to 'false'. If set to 'true', it will return the redcap_survey_identifier field and also the survey timestamp field for a particular survey when at least one field from that survey is being exported. NOTE: If the survey identifier field or survey timestamp fields are imported via API data import, they will simply be ignored since they are not real fields in the project but rather are pseudo-fields. + /// true, false [default] - specifies whether or not to export the 'redcap_data_access_group' field when data access groups are utilized in the project. If you do not pass in this flag, it will default to 'false'. NOTE: This flag is only viable if the user whose token is being used to make the API request is *not* in a data access group. If the user is in a group, then this flag will revert to its default value. + /// String of logic text (e.g., [age] > 30) for filtering the data to be returned by this API method, in which the API will only return the records (or record-events, if a longitudinal project) where the logic evaluates as TRUE. This parameter is blank/null by default unless a value is supplied. Please note that if the filter logic contains any incorrect syntax, the API will respond with an error message. + /// true, false [default] - TRUE will cause the XML returned to include all files uploaded for File Upload and Signature fields for all records in the project, whereas FALSE will cause all such fields not to be included. NOTE: Setting this option to TRUE can make the export very large and may prevent it from completing if the project contains many files or very large files. + /// The entire REDCap project's metadata (and data, if specified) will be returned in CDISC ODM format as a single XML string. + Task ExportProjectXmlAsync(string token, bool returnMetadataOnly = false, string[] records = null, string[] fields = null, string[] events = null, RedcapReturnFormat returnFormat = RedcapReturnFormat.json, bool exportSurveyFields = false, bool exportDataAccessGroups = false, string filterLogic = null, bool exportFiles = false); #endregion #region Records /// - /// Export Records + /// From Redcap Version 11.4.0
+ /// Export Records
/// This method allows you to export a set of records for a project. /// Note about export rights: Please be aware that Data Export user rights will be applied to this API request.For example, if you have 'No Access' data export rights in the project, then the API data export will fail and return an error. And if you have 'De-Identified' or 'Remove all tagged Identifier fields' data export rights, then some data fields *might* be removed and filtered out of the data set returned from the API. To make sure that no data is unnecessarily filtered out of your API request, you should have 'Full Data Set' export rights in the project. ///
@@ -138,9 +1115,10 @@ public interface IRedcap /// If specified, force all numbers into same decimal format. You may choose to force all data values containing a decimal to have the same decimal character, which will be applied to all calc fields and number-validated text fields. Options include comma ',' or dot/full stop '.', but if left blank/null, then it will export numbers using the fields' native decimal format. Simply provide the value of either ',' or '.' for this parameter. /// true, false [default] - specifies whether or not to export blank values for instrument complete status fields that have a gray status icon. All instrument complete status fields having a gray icon can be exported either as a blank value or as "0" (Incomplete). Blank values are recommended in a data export if the data will be re-imported into a REDCap project. /// Data from the project in the format and type specified ordered by the record (primary key of project) and then by event id - Task ExportRecordsAsync(string token, Content content, RedcapFormat format, RedcapDataType redcapDataType, string[] records = null, string[] fields = null, string[] forms = null, string[] events = null, RawOrLabel rawOrLabel = RawOrLabel.raw, RawOrLabelHeaders rawOrLabelHeaders = RawOrLabelHeaders.raw, bool exportCheckboxLabel = false, OnErrorFormat returnFormat = OnErrorFormat.json, bool exportSurveyFields = false, bool exportDataAccessGroups = false, string filterLogic = null, DateTime? dateRangeBegin = null, DateTime? dateRangeEnd = null, string csvDelimiter = null, string decimalCharacter = null, bool exportBlankForGrayFormStatus = false); + Task ExportRecordsAsync(string token, Content content, RedcapFormat format, RedcapDataType redcapDataType, string[] records = null, string[] fields = null, string[] forms = null, string[] events = null, RawOrLabel rawOrLabel = RawOrLabel.raw, RawOrLabelHeaders rawOrLabelHeaders = RawOrLabelHeaders.raw, bool exportCheckboxLabel = false, RedcapReturnFormat returnFormat = RedcapReturnFormat.json, bool exportSurveyFields = false, bool exportDataAccessGroups = false, string filterLogic = null, DateTime? dateRangeBegin = null, DateTime? dateRangeEnd = null, string csvDelimiter = null, string decimalCharacter = null, bool exportBlankForGrayFormStatus = false); /// - /// Export Records + /// From Redcap Version 11.4.0
+ /// Export Records
/// This method allows you to export a set of records for a project. /// Note about export rights: Please be aware that Data Export user rights will be applied to this API request.For example, if you have 'No Access' data export rights in the project, then the API data export will fail and return an error. And if you have 'De-Identified' or 'Remove all tagged Identifier fields' data export rights, then some data fields *might* be removed and filtered out of the data set returned from the API. To make sure that no data is unnecessarily filtered out of your API request, you should have 'Full Data Set' export rights in the project. ///
@@ -148,7 +1126,7 @@ public interface IRedcap /// To use this method, you must have API Export privileges in the project. ///
/// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. - /// csv, json [default], xml, odm ('odm' refers to CDISC ODM XML format, specifically ODM version 1.3.1) + /// csv, json [default], xml, odm ('odm' refers to CDISC ODM XML format, specifically ODM version 1.3.1) /// flat - output as one record per row [default], eav - output as one data point per row. Non-longitudinal: Will have the fields - record*, field_name, value. Longitudinal: Will have the fields - record*, field_name, value, redcap_event_name /// an array of record names specifying specific records you wish to pull (by default, all records are pulled) /// an array of field names specifying specific fields you wish to pull (by default, all fields are pulled) @@ -167,58 +1145,634 @@ public interface IRedcap /// If specified, force all numbers into same decimal format. You may choose to force all data values containing a decimal to have the same decimal character, which will be applied to all calc fields and number-validated text fields. Options include comma ',' or dot/full stop '.', but if left blank/null, then it will export numbers using the fields' native decimal format. Simply provide the value of either ',' or '.' for this parameter. /// true, false [default] - specifies whether or not to export blank values for instrument complete status fields that have a gray status icon. All instrument complete status fields having a gray icon can be exported either as a blank value or as "0" (Incomplete). Blank values are recommended in a data export if the data will be re-imported into a REDCap project. /// Data from the project in the format and type specified ordered by the record (primary key of project) and then by event id - Task ExportRecordsAsync(string token, RedcapFormat inputFormat, RedcapDataType redcapDataType, string[] records = null, string[] fields = null, string[] forms = null, string[] events = null, RawOrLabel rawOrLabel = RawOrLabel.raw, RawOrLabelHeaders rawOrLabelHeaders = RawOrLabelHeaders.raw, bool exportCheckboxLabel = false, OnErrorFormat returnFormat = OnErrorFormat.json, bool exportSurveyFields = false, bool exportDataAccessGroups = false, string filterLogic = null, DateTime? dateRangeBegin = null, DateTime? dateRangeEnd = null, string csvDelimiter = null, string decimalCharacter = null, bool exportBlankForGrayFormStatus = false); + Task ExportRecordsAsync(string token, RedcapFormat format, RedcapDataType redcapDataType, string[] records = null, string[] fields = null, string[] forms = null, string[] events = null, RawOrLabel rawOrLabel = RawOrLabel.raw, RawOrLabelHeaders rawOrLabelHeaders = RawOrLabelHeaders.raw, bool exportCheckboxLabel = false, RedcapReturnFormat returnFormat = RedcapReturnFormat.json, bool exportSurveyFields = false, bool exportDataAccessGroups = false, string filterLogic = default, DateTime? dateRangeBegin = default, DateTime? dateRangeEnd = default, string csvDelimiter = default, string decimalCharacter = default, bool exportBlankForGrayFormStatus = false); + /// + /// From Redcap Version 10.3.0
+ /// Import Records
+ /// This method allows you to import a set of records for a project + ///
+ /// + /// To use this method, you must have API Import/Update privileges in the project. + /// + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// record + /// csv, json [default], xml, odm ('odm' refers to CDISC ODM XML format, specifically ODM version 1.3.1) + /// flat - output as one record per row [default] + /// eav - input as one data point per row + /// Non-longitudinal: Will have the fields - record*, field_name, value + /// Longitudinal: Will have the fields - record*, field_name, value, redcap_event_name + /// + /// + /// normal - blank/empty values will be ignored [default] + /// overwrite - blank/empty values are valid and will overwrite data + /// If record auto-numbering has been enabled in the project, it may be desirable to import records where each record's record name is automatically determined by REDCap (just as it does in the user interface). If this parameter is set to 'true', the record names provided in the request will not be used (although they are still required in order to associate multiple rows of data to an individual record in the request), but instead those records in the request will receive new record names during the import process. NOTE: To see how the provided record names get translated into new auto record names, the returnContent parameter should be set to 'auto_ids', which will return a record list similar to 'ids' value, but it will have the new record name followed by the provided record name in the request, in which the two are comma-delimited. For example, if + /// false (or 'false') - The record names provided in the request will be used. [default] + /// true (or 'true') - New record names will be automatically determined. + /// The formatted data to be imported. The data should be a List of Dictionary(string,string) or object that contains the fields and values. + /// NOTE: When importing data in EAV type format, please be aware that checkbox fields must have their field_name listed as variable+'___'+optionCode and its value as either '0' or '1' (unchecked or checked, respectively). For example, for a checkbox field with variable name 'icecream', it would be imported as EAV with the field_name as 'icecream___4' having a value of '1' in order to set the option coded with '4' (which might be 'Chocolate') as 'checked'. + /// MDY, DMY, YMD [default] - the format of values being imported for dates or datetime fields (understood with M representing 'month', D as 'day', and Y as 'year') - NOTE: The default format is Y-M-D (with dashes), while MDY and DMY values should always be formatted as M/D/Y or D/M/Y (with slashes), respectively. + /// Set the delimiter used to separate values in the CSV data file (for CSV format only). Options include: comma ',' (default), 'tab', semi-colon ';', pipe '|', or caret '^'. Simply provide the value in quotes for this parameter. + /// count [default] - the number of records imported, ids - a list of all record IDs that were imported, auto_ids = (used only when forceAutoNumber=true) a list of pairs of all record IDs that were imported, includes the new ID created and the ID value that was sent in the API request (e.g., 323,10). + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// the content specified by returnContent + + Task ImportRecordsAsync(string token, Content content, RedcapFormat format, RedcapDataType redcapDataType, OverwriteBehavior overwriteBehavior, bool forceAutoNumber, List data, string dateFormat = "", CsvDelimiter csvDelimiter = CsvDelimiter.tab, ReturnContent returnContent = ReturnContent.count, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + /// + /// From Redcap version with version 10.3.0
+ /// Import Records
+ /// This method allows you to import a set of records for a project + ///
+ /// + /// To use this method, you must have API Import/Update privileges in the project. + /// + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// csv, json [default], xml, odm ('odm' refers to CDISC ODM XML format, specifically ODM version 1.3.1) + /// flat - output as one record per row [default] + /// eav - input as one data point per row + /// Non-longitudinal: Will have the fields - record*, field_name, value + /// Longitudinal: Will have the fields - record*, field_name, value, redcap_event_name + /// + /// + /// normal - blank/empty values will be ignored [default] + /// overwrite - blank/empty values are valid and will overwrite data + /// If record auto-numbering has been enabled in the project, it may be desirable to import records where each record's record name is automatically determined by REDCap (just as it does in the user interface). + /// If this parameter is set to 'true', the record names provided in the request will not be used (although they are still required in order to associate multiple rows of data to an individual record in the request), but instead those records in the request will receive new record names during the import process. + /// NOTE: To see how the provided record names get translated into new auto record names, the returnContent parameter should be set to 'auto_ids', which will return a record list similar to 'ids' value, but it will have the new record name followed by the provided record name in the request, in which the two are comma-delimited. For example, if + /// false (or 'false') - The record names provided in the request will be used. [default] + /// true (or 'true') - New record names will be automatically determined. + /// The formatted data to be imported. The data should be a List of Dictionary(string,string) or object that contains the fields and values. + /// NOTE: When importing data in EAV type format, please be aware that checkbox fields must have their field_name listed as variable+'___'+optionCode and its value as either '0' or '1' (unchecked or checked, respectively). For example, for a checkbox field with variable name 'icecream', it would be imported as EAV with the field_name as 'icecream___4' having a value of '1' in order to set the option coded with '4' (which might be 'Chocolate') as 'checked'. + /// MDY, DMY, YMD [default] - the format of values being imported for dates or datetime fields (understood with M representing 'month', D as 'day', and Y as 'year') - NOTE: The default format is Y-M-D (with dashes), while MDY and DMY values should always be formatted as M/D/Y or D/M/Y (with slashes), respectively. + /// Set the delimiter used to separate values in the CSV data file (for CSV format only). Options include: comma ',' (default), 'tab', semi-colon ';', pipe '|', or caret '^'. Simply provide the value in quotes for this parameter. + /// count [default] - the number of records imported, ids - a list of all record IDs that were imported, auto_ids = (used only when forceAutoNumber=true) a list of pairs of all record IDs that were imported, includes the new ID created and the ID value that was sent in the API request (e.g., 323,10). + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// the content specified by returnContent + + Task ImportRecordsAsync(string token, RedcapFormat format, RedcapDataType redcapDataType, OverwriteBehavior overwriteBehavior, bool forceAutoNumber, List data, string dateFormat = default, CsvDelimiter csvDelimiter = CsvDelimiter.tab, ReturnContent returnContent = ReturnContent.count, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + /// + /// Delete Records
+ /// This method allows you to delete one or more records from a project in a single API request. + ///
+ /// + /// + /// To use this method, you must have 'Delete Record' user privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// record + /// delete + /// an array of record names specifying specific records you wish to delete + /// the arm number of the arm in which the record(s) should be deleted. + /// (This can only be used if the project is longitudinal with more than one arm.) NOTE: If the arm parameter is not provided, the specified records will be deleted from all arms in which they exist. Whereas, if arm is provided, they will only be deleted from the specified arm. + /// + /// + /// + /// the number of records deleted or (if instrument, event, and/or instance are provided) the number of items deleted over the total records specified. - Task ImportRecordsAsync(string token, Content content, ReturnFormat inputFormat, RedcapDataType redcapDataType, OverwriteBehavior overwriteBehavior, bool forceAutoNumber, List data, string dateFormat = "", CsvDelimiter csvDelimiter = CsvDelimiter.tab, ReturnContent returnContent = ReturnContent.count, OnErrorFormat returnFormat = OnErrorFormat.json); - Task ImportRecordsAsync(string token, ReturnFormat inputFormat, RedcapDataType redcapDataType, OverwriteBehavior overwriteBehavior, bool forceAutoNumber, List data, string dateFormat = "", CsvDelimiter csvDelimiter = CsvDelimiter.tab, ReturnContent returnContent = ReturnContent.count, OnErrorFormat returnFormat = OnErrorFormat.json); + Task DeleteRecordsAsync(string token, Content content, RedcapAction action, string[] records, int? arm, RedcapInstrument instrument, RedcapEvent redcapEvent, RedcapRepeatInstance repeatInstance); + /// + /// Delete Records
+ /// This method allows you to delete one or more records from a project in a single API request. + ///
+ /// + /// + /// To use this method, you must have 'Delete Record' user privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// record + /// delete + /// an array of record names specifying specific records you wish to delete + /// the arm number of the arm in which the record(s) should be deleted. + /// (This can only be used if the project is longitudinal with more than one arm.) NOTE: If the arm parameter is not provided, the specified records will be deleted from all arms in which they exist. Whereas, if arm is provided, they will only be deleted from the specified arm. + /// the number of records deleted or (if instrument, event, and/or instance are provided) the number of items deleted over the total records specified. Task DeleteRecordsAsync(string token, Content content, RedcapAction action, string[] records, int? arm); + /// + /// Delete Records
+ /// This method allows you to delete one or more records from a project in a single API request. + ///
+ /// + /// + /// To use this method, you must have 'Delete Record' user privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// an array of record names specifying specific records you wish to delete + /// the arm number of the arm in which the record(s) should be deleted. + /// (This can only be used if the project is longitudinal with more than one arm.) NOTE: If the arm parameter is not provided, the specified records will be deleted from all arms in which they exist. Whereas, if arm is provided, they will only be deleted from the specified arm. + /// the number of records deleted or (if instrument, event, and/or instance are provided) the number of items deleted over the total records specified. + Task DeleteRecordsAsync(string token, string[] records, int? arm); - Task RenameRecordAsync(string token, string record, string newRecordName, Content content, RedcapAction action, int? arm); + /// + /// From Redcap Version 11.3.3
+ /// + /// Rename Record
+ /// This method allows you to rename a record from a project in a single API request. + /// + ///
+ /// + /// To use this method, you must have 'Rename Record' user privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// record + /// rename + /// record name of the current record which you want to rename to new name. + /// new record name to which you want to rename current record. + /// specific arm number in which current record exists. If null, then all records with same name across all arms on which it exists (if longitudinal with multiple arms) will be renamed to new record name, otherwise it will rename the record only in the specified arm. + /// Returns "1" if record is renamed or error message if any. + + Task RenameRecordAsync(string token, Content content, RedcapAction action, string record, string newRecordName, int? arm); + + /// + /// From Redcap Version 6.18.0
+ /// Generate Next Record Name
+ /// To be used by projects with record auto-numbering enabled, this method exports the next potential record ID for a project. It generates the next record name by determining the current maximum numerical record ID and then incrementing it by one. + /// Note: This method does not create a new record, but merely determines what the next record name would be. + /// If using Data Access Groups (DAGs) in the project, this method accounts for the special formatting of the record name for users in DAGs (e.g., DAG-ID); in this case, it only assigns the next value for ID for all numbers inside a DAG. For example, if a DAG has a corresponding DAG number of 223 wherein records 223-1 and 223-2 already exist, then the next record will be 223-3 if the API user belongs to the DAG that has DAG number 223. (The DAG number is auto-assigned by REDCap for each DAG when the DAG is first created.) When generating a new record name in a DAG, the method considers all records in the entire project when determining the maximum record ID, including those that might have been originally created in that DAG but then later reassigned to another DAG. + /// Note: This method functions the same even for projects that do not have record auto-numbering enabled. + ///
+ /// + /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// generateNextRecordName + /// The maximum integer record ID + 1. Task GenerateNextRecordNameAsync(string token, Content content = Content.GenerateNextRecordName); + + /// + /// From Redcap Version 6.18.0
+ /// Generate Next Record Name
+ /// To be used by projects with record auto-numbering enabled, this method exports the next potential record ID for a project. It generates the next record name by determining the current maximum numerical record ID and then incrementing it by one. + /// Note: This method does not create a new record, but merely determines what the next record name would be.
+ /// If using Data Access Groups (DAGs) in the project, this method accounts for the special formatting of the record name for users in DAGs (e.g., DAG-ID); in this case, it only assigns the next value for ID for all numbers inside a DAG. For example, if a DAG has a corresponding DAG number of 223 wherein records 223-1 and 223-2 already exist, then the next record will be 223-3 if the API user belongs to the DAG that has DAG number 223. (The DAG number is auto-assigned by REDCap for each DAG when the DAG is first created.) When generating a new record name in a DAG, the method considers all records in the entire project when determining the maximum record ID, including those that might have been originally created in that DAG but then later reassigned to another DAG. + /// Note: This method functions the same even for projects that do not have record auto-numbering enabled. + ///
+ /// + /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// The maximum integer record ID + 1. + Task GenerateNextRecordNameAsync(string token); #endregion #region Repeating Instruments and Events - Task ExportRepeatingInstrumentsAndEvents(string token, Content content = Content.RepeatingFormsEvents, ReturnFormat format = ReturnFormat.json); - Task ExportRepeatingInstrumentsAndEvents(string token, ReturnFormat format = ReturnFormat.json); - Task ImportRepeatingInstrumentsAndEvents(string token, List data, Content content = Content.RepeatingFormsEvents, ReturnFormat returnFormat = ReturnFormat.json, OnErrorFormat onErrorFormat = OnErrorFormat.json); + /// + /// From Redcap Version 8.2.0
+ /// + /// Export Repeating Instruments and Events
+ /// + /// This method allows you to export a list of the repeated instruments and repeating events for a project. This includes their unique instrument name as seen in the second column of the Data Dictionary, as well as each repeating instrument's corresponding custom repeating instrument label. For longitudinal projects, the unique event name is also returned for each repeating instrument. Additionally, repeating events are returned as separate items, in which the instrument name will be blank/null to indicate that it is a repeating event (rather than a repeating instrument). + ///
+ /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// csv, json [default], xml odm ('odm' refers to CDISC ODM XML format, specifically ODM version 1.3.1) + /// Repeated instruments and events for the project in the format specified and will be ordered according to their order in the project. + + Task ExportRepeatingInstrumentsAndEvents(string token, RedcapFormat format = RedcapFormat.json); + + /// + /// From Redcap Version 8.2.0
+ /// + /// Export Repeating Instruments and Events
+ /// + /// This method allows you to export a list of the repeated instruments and repeating events for a project. This includes their unique instrument name as seen in the second column of the Data Dictionary, as well as each repeating instrument's corresponding custom repeating instrument label. For longitudinal projects, the unique event name is also returned for each repeating instrument. Additionally, repeating events are returned as separate items, in which the instrument name will be blank/null to indicate that it is a repeating event (rather than a repeating instrument). + ///
+ /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// repeatingFormsEvents + /// csv, json [default], xml odm ('odm' refers to CDISC ODM XML format, specifically ODM version 1.3.1) + /// Repeated instruments and events for the project in the format specified and will be ordered according to their order in the project. + Task ExportRepeatingInstrumentsAndEvents(string token, Content content = Content.RepeatingFormsEvents, RedcapFormat format = RedcapFormat.json); + /// + /// From Redcap Version 8.10.0
+ /// + /// Import Repeating Instruments and Events
+ /// This method allows you to import a list of the repeated instruments and repeating events for a project. This includes their unique instrument name as seen in the second column of the Data Dictionary, as well as each repeating instrument's corresponding custom repeating instrument label. For longitudinal projects, the unique event name is also needed for each repeating instrument. Additionally, repeating events must be submitted as separate items, in which the instrument name will be blank/null to indicate that it is a repeating event (rather than a repeating instrument). + ///
+ /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// Note: Super API Tokens can also be utilized for this method instead of a project-level API token. Users can only be granted a super token by a REDCap administrator (using the API Tokens page in the REDCap Control Center). + /// repeatingFormsEvents + /// csv, json [default], xml + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// Number of repeated isntruments or repeated events that have been imported + + Task ImportRepeatingInstrumentsAndEvents(string token, List data, Content content = Content.RepeatingFormsEvents, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); #endregion #region Export Reports - Task ExportReportsAsync(string token, Content content, int reportId, ReturnFormat inputFormat = ReturnFormat.json, OnErrorFormat returnFormat = OnErrorFormat.json, RawOrLabel rawOrLabel = RawOrLabel.raw, RawOrLabelHeaders rawOrLabelHeaders = RawOrLabelHeaders.raw, bool exportCheckboxLabel = false); - Task ExportReportsAsync(string token, int reportId, ReturnFormat inputFormat = ReturnFormat.json, OnErrorFormat returnFormat = OnErrorFormat.json, RawOrLabel rawOrLabel = RawOrLabel.raw, RawOrLabelHeaders rawOrLabelHeaders = RawOrLabelHeaders.raw, bool exportCheckboxLabel = false); + /// + /// Export Reports
+ /// This method allows you to export the data set of a report created on a project's 'Data Exports, Reports, and Stats' page. + /// Note about export rights: Please be aware that Data Export user rights will be applied to this API request.For example, if you have 'No Access' data export rights in the project, then the API report export will fail and return an error. And if you have 'De-Identified' or 'Remove all tagged Identifier fields' data export rights, then some data fields *might* be removed and filtered out of the data set returned from the API. To make sure that no data is unnecessarily filtered out of your API request, you should have 'Full Data Set' export rights in the project. + /// Also, please note the the 'Export Reports' method does *not* make use of the 'type' (flat/eav) parameter, which can be used in the 'Export Records' method.All data for the 'Export Reports' method is thus exported in flat format.If the 'type' parameter is supplied in the API request, it will be ignored. + ///
+ /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// the report ID number provided next to the report name on the report list page + /// csv, json [default], xml odm ('odm' refers to CDISC ODM XML format, specifically ODM version 1.3.1) + /// csv, json [default], xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// raw [default], label - export the raw coded values or labels for the options of multiple choice fields + /// raw [default], label - (for 'csv' format 'flat' type only) for the CSV headers, export the variable/field names (raw) or the field labels (label) + /// true, false [default] - specifies the format of checkbox field values specifically when exporting the data as labels (i.e., when rawOrLabel=label). When exporting labels, by default (without providing the exportCheckboxLabel flag or if exportCheckboxLabel=false), all checkboxes will either have a value 'Checked' if they are checked or 'Unchecked' if not checked. But if exportCheckboxLabel is set to true, it will instead export the checkbox value as the checkbox option's label (e.g., 'Choice 1') if checked or it will be blank/empty (no value) if not checked. If rawOrLabel=false, then the exportCheckboxLabel flag is ignored. + /// + /// + /// Data from the project in the format and type specified ordered by the record (primary key of project) and then by event id + + Task ExportReportsAsync(string token, int reportId, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json, RawOrLabel rawOrLabel = RawOrLabel.raw, RawOrLabelHeaders rawOrLabelHeaders = RawOrLabelHeaders.raw, bool exportCheckboxLabel = false, string csvDelimiter = default, string decimalCharacter = default); + /// + /// Export Reports
+ /// This method allows you to export the data set of a report created on a project's 'Data Exports, Reports, and Stats' page. + /// Note about export rights: Please be aware that Data Export user rights will be applied to this API request.For example, if you have 'No Access' data export rights in the project, then the API report export will fail and return an error. And if you have 'De-Identified' or 'Remove all tagged Identifier fields' data export rights, then some data fields *might* be removed and filtered out of the data set returned from the API. To make sure that no data is unnecessarily filtered out of your API request, you should have 'Full Data Set' export rights in the project. + /// Also, please note the the 'Export Reports' method does *not* make use of the 'type' (flat/eav) parameter, which can be used in the 'Export Records' method.All data for the 'Export Reports' method is thus exported in flat format.If the 'type' parameter is supplied in the API request, it will be ignored. + ///
+ /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// report + /// the report ID number provided next to the report name on the report list page + /// csv, json [default], xml odm ('odm' refers to CDISC ODM XML format, specifically ODM version 1.3.1) + /// csv, json [default], xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// raw [default], label - export the raw coded values or labels for the options of multiple choice fields + /// raw [default], label - (for 'csv' format 'flat' type only) for the CSV headers, export the variable/field names (raw) or the field labels (label) + /// true, false [default] - specifies the format of checkbox field values specifically when exporting the data as labels (i.e., when rawOrLabel=label). When exporting labels, by default (without providing the exportCheckboxLabel flag or if exportCheckboxLabel=false), all checkboxes will either have a value 'Checked' if they are checked or 'Unchecked' if not checked. But if exportCheckboxLabel is set to true, it will instead export the checkbox value as the checkbox option's label (e.g., 'Choice 1') if checked or it will be blank/empty (no value) if not checked. If rawOrLabel=false, then the exportCheckboxLabel flag is ignored. + /// + /// + /// Data from the project in the format and type specified ordered by the record (primary key of project) and then by event id + + Task ExportReportsAsync(string token, Content content, int reportId, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json, RawOrLabel rawOrLabel = RawOrLabel.raw, RawOrLabelHeaders rawOrLabelHeaders = RawOrLabelHeaders.raw, bool exportCheckboxLabel = false, string csvDelimiter = default, string decimalCharacter = default); + #endregion #region REDCap - Task ExportRedcapVersionAsync(string token, Content content = Content.Version, ReturnFormat inputFormat = ReturnFormat.json); - Task ExportRedcapVersionAsync(string token, ReturnFormat inputFormat = ReturnFormat.json); + /// + /// Export REDCap Version
+ /// This method returns the current REDCap version number as plain text (e.g., 4.13.18, 5.12.2, 6.0.0). + ///
+ /// + /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// version + /// csv, json [default], xml + /// The current REDCap version number (three numbers delimited with two periods) as plain text - e.g., 4.13.18, 5.12.2, 6.0.0 + Task ExportRedcapVersionAsync(string token, Content content = Content.Version, RedcapFormat format = RedcapFormat.json); + /// + /// Export REDCap Version
+ /// This method returns the current REDCap version number as plain text (e.g., 4.13.18, 5.12.2, 6.0.0). + ///
+ /// + /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// csv, json [default], xml + /// The current REDCap version number (three numbers delimited with two periods) as plain text - e.g., 4.13.18, 5.12.2, 6.0.0 + Task ExportRedcapVersionAsync(string token, RedcapFormat format = RedcapFormat.json); #endregion #region Surveys - Task ExportSurveyLinkAsync(string token, Content content, string record, string instrument, string eventName, int repeatInstance, OnErrorFormat returnFormat = OnErrorFormat.json); - Task ExportSurveyLinkAsync(string token, string record, string instrument, string eventName, int repeatInstance, OnErrorFormat returnFormat = OnErrorFormat.json); + /// + /// From Redcap Version 6.4.0
+ /// Export a Survey Link for a Participant + /// This method returns a unique survey link (i.e., a URL) in plain text format for a specified record and data collection instrument (and event, if longitudinal) in a project. If the user does not have 'Manage Survey Participants' privileges, they will not be able to use this method, and an error will be returned. If the specified data collection instrument has not been enabled as a survey in the project, an error will be returned. + ///
+ /// + /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// the record ID. The name of the record in the project. + /// the unique instrument name as seen in the second column of the Data Dictionary. This instrument must be enabled as a survey in the project. + /// the unique event name (for longitudinal projects only). + /// (only for projects with repeating instruments/events) The repeat instance number of the repeating event (if longitudinal) or the repeating instrument (if classic or longitudinal). Default value is '1'. + /// csv, json [default], xml - The returnFormat is only used with regard to the format of any error messages that might be returned. + /// Returns a unique survey link (i.e., a URL) in plain text format for the specified record and instrument (and event, if longitudinal). + + Task ExportSurveyLinkAsync(string token, string record, string instrument, string eventName, int repeatInstance, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + /// + /// From Redcap Version 6.4.0
+ /// Export a Survey Link for a Participant
+ /// This method returns a unique survey link (i.e., a URL) in plain text format for a specified record and data collection instrument (and event, if longitudinal) in a project. If the user does not have 'Manage Survey Participants' privileges, they will not be able to use this method, and an error will be returned. If the specified data collection instrument has not been enabled as a survey in the project, an error will be returned. + ///
+ /// + /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// surveyLink + /// the record ID. The name of the record in the project. + /// the unique instrument name as seen in the second column of the Data Dictionary. This instrument must be enabled as a survey in the project. + /// the unique event name (for longitudinal projects only). + /// (only for projects with repeating instruments/events) The repeat instance number of the repeating event (if longitudinal) or the repeating instrument (if classic or longitudinal). Default value is '1'. + /// csv, json [default], xml - The returnFormat is only used with regard to the format of any error messages that might be returned. + /// Returns a unique survey link (i.e., a URL) in plain text format for the specified record and instrument (and event, if longitudinal). + + Task ExportSurveyLinkAsync(string token, Content content, string record, string instrument, string eventName, int repeatInstance, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + /// + /// Export a Survey Participant List
+ /// This method returns the list of all participants for a specific survey instrument (and for a specific event, if a longitudinal project). If the user does not have 'Manage Survey Participants' privileges, they will not be able to use this method, and an error will be returned. If the specified data collection instrument has not been enabled as a survey in the project, an error will be returned. + ///
+ /// + /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// participantList + /// the unique instrument name as seen in the second column of the Data Dictionary. This instrument must be enabled as a survey in the project. + /// the unique event name (for longitudinal projects only). + /// csv, json [default], xml + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// Returns the list of all participants for the specified survey instrument [and event] in the desired format. The following fields are returned: email, email_occurrence, identifier, invitation_sent_status, invitation_send_time, response_status, survey_access_code, survey_link. The attribute 'email_occurrence' represents the current count that the email address has appeared in the list (because emails can be used more than once), thus email + email_occurrence represent a unique value pair. 'invitation_sent_status' is '0' if an invitation has not yet been sent to the participant, and is '1' if it has. 'invitation_send_time' is the date/time in which the next invitation will be sent, and is blank if there is no invitation that is scheduled to be sent. 'response_status' represents whether the participant has responded to the survey, in which its value is 0, 1, or 2 for 'No response', 'Partial', or 'Completed', respectively. Note: If an incorrect event_id or instrument name is used or if the instrument has not been enabled as a survey, then an error will be returned. - Task ExportSurveyParticipantsAsync(string token, Content content, string instrument, string eventName, ReturnFormat inputFormat = ReturnFormat.json, OnErrorFormat returnFormat = OnErrorFormat.json); - Task ExportSurveyParticipantsAsync(string token, string instrument, string eventName, ReturnFormat inputFormat = ReturnFormat.json, OnErrorFormat returnFormat = OnErrorFormat.json); + Task ExportSurveyParticipantsAsync(string token, Content content, string instrument, string eventName, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + /// + /// Export a Survey Participant List
+ /// This method returns the list of all participants for a specific survey instrument (and for a specific event, if a longitudinal project). If the user does not have 'Manage Survey Participants' privileges, they will not be able to use this method, and an error will be returned. If the specified data collection instrument has not been enabled as a survey in the project, an error will be returned. + ///
+ /// + /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// the unique instrument name as seen in the second column of the Data Dictionary. This instrument must be enabled as a survey in the project. + /// the unique event name (for longitudinal projects only). + /// csv, json [default], xml + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// Returns the list of all participants for the specified survey instrument [and event] in the desired format. The following fields are returned: email, email_occurrence, identifier, invitation_sent_status, invitation_send_time, response_status, survey_access_code, survey_link. The attribute 'email_occurrence' represents the current count that the email address has appeared in the list (because emails can be used more than once), thus email + email_occurrence represent a unique value pair. 'invitation_sent_status' is '0' if an invitation has not yet been sent to the participant, and is '1' if it has. 'invitation_send_time' is the date/time in which the next invitation will be sent, and is blank if there is no invitation that is scheduled to be sent. 'response_status' represents whether the participant has responded to the survey, in which its value is 0, 1, or 2 for 'No response', 'Partial', or 'Completed', respectively. Note: If an incorrect event_id or instrument name is used or if the instrument has not been enabled as a survey, then an error will be returned. + Task ExportSurveyParticipantsAsync(string token, string instrument, string eventName, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + /// + /// From Redcap Version 6.4.0
+ /// + /// Export a Survey Queue Link for a Participant
+ /// This method returns a unique Survey Queue link (i.e., a URL) in plain text format for the specified record in a project that is utilizing the Survey Queue feature. If the user does not have 'Manage Survey Participants' privileges, they will not be able to use this method, and an error will be returned. If the Survey Queue feature has not been enabled in the project, an error will be + ///
+ /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// surveyQueueLink + /// the record ID. The name of the record in the project. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// Returns a unique Survey Queue link (i.e., a URL) in plain text format for the specified record in the project. - Task ExportSurveyQueueLinkAsync(string token, Content content, string record, OnErrorFormat returnFormat = OnErrorFormat.json); - Task ExportSurveyQueueLinkAsync(string token, string record, OnErrorFormat returnFormat = OnErrorFormat.json); + Task ExportSurveyQueueLinkAsync(string token, Content content, string record, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + /// + /// From Redcap Version 6.4.0
+ /// + /// Export a Survey Queue Link for a Participant
+ /// This method returns a unique Survey Queue link (i.e., a URL) in plain text format for the specified record in a project that is utilizing the Survey Queue feature. If the user does not have 'Manage Survey Participants' privileges, they will not be able to use this method, and an error will be returned. If the Survey Queue feature has not been enabled in the project, an error will be + ///
+ /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// the record ID. The name of the record in the project. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// Returns a unique Survey Queue link (i.e., a URL) in plain text format for the specified record in the project. + Task ExportSurveyQueueLinkAsync(string token, string record, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + /// + /// From Redcap Version 6.4.0
+ /// Export a Survey Return Code for a Participant
+ /// This method returns a unique Return Code in plain text format for a specified record and data collection instrument (and event, if longitudinal) in a project. If the user does not have 'Manage Survey Participants' privileges, they will not be able to use this method, and an error will be returned. If the specified data collection instrument has not been enabled as a survey in the project or does not have the 'Save and Return Later' feature enabled, an error will be returned. + ///
+ /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// surveyReturnCode + /// the record ID. The name of the record in the project. + /// the unique instrument name as seen in the second column of the Data Dictionary. This instrument must be enabled as a survey in the project. + /// the unique event name (for longitudinal projects only). + /// (only for projects with repeating instruments/events) The repeat instance number of the repeating event (if longitudinal) or the repeating instrument (if classic or longitudinal). Default value is '1'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// Returns a unique Return Code in plain text format for the specified record and instrument (and event, if longitudinal). - Task ExportSurveyReturnCodeAsync(string token, Content content, string record, string instrument, string eventName, string repeatInstance, OnErrorFormat returnFormat = OnErrorFormat.json); - Task ExportSurveyReturnCodeAsync(string token, string record, string instrument, string eventName, string repeatInstance, OnErrorFormat returnFormat = OnErrorFormat.json); + Task ExportSurveyReturnCodeAsync(string token, Content content, string record, string instrument, string eventName, string repeatInstance, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + /// + /// From Redcap Version 6.4.0
+ /// Export a Survey Return Code for a Participant
+ /// This method returns a unique Return Code in plain text format for a specified record and data collection instrument (and event, if longitudinal) in a project. If the user does not have 'Manage Survey Participants' privileges, they will not be able to use this method, and an error will be returned. If the specified data collection instrument has not been enabled as a survey in the project or does not have the 'Save and Return Later' feature enabled, an error will be returned. + ///
+ /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// the record ID. The name of the record in the project. + /// the unique instrument name as seen in the second column of the Data Dictionary. This instrument must be enabled as a survey in the project. + /// the unique event name (for longitudinal projects only). + /// (only for projects with repeating instruments/events) The repeat instance number of the repeating event (if longitudinal) or the repeating instrument (if classic or longitudinal). Default value is '1'. + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// Returns a unique Return Code in plain text format for the specified record and instrument (and event, if longitudinal). + Task ExportSurveyReturnCodeAsync(string token, string record, string instrument, string eventName, string repeatInstance, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); #endregion #region Users & User Privileges - Task ExportUsersAsync(string token, Content content = Content.User, ReturnFormat inputFormat = ReturnFormat.json, OnErrorFormat returnFormat = OnErrorFormat.json); - Task ExportUsersAsync(string token, ReturnFormat inputFormat = ReturnFormat.json, OnErrorFormat returnFormat = OnErrorFormat.json); - Task ImportUsersAsync(string token, Content content, List data, ReturnFormat inputFormat = ReturnFormat.json, OnErrorFormat returnFormat = OnErrorFormat.json); - Task ImportUsersAsync(string token, List data, ReturnFormat inputFormat = ReturnFormat.json, OnErrorFormat returnFormat = OnErrorFormat.json); + /// + /// From Redcap Version 4.7.0
+ /// + /// Export Users
+ /// This method allows you to export the list of users for a project, including their user privileges and also email address, first name, and last name. Note: If the user has been assigned to a user role, it will return the user with the role's defined privileges. + ///
+ /// + /// To use this method, you must have API Export privileges in the project.
+ /// Data Export:
0=No Access,
2=De-Identified,
1=Full Data Set + /// Form Rights:
0=No Access,
2=Read Only,
1=View records/responses and edit records(survey responses are read-only),
3=Edit survey responses + /// Other attribute values: 0=No Access, 1=Access. + ///
+ /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// user + /// csv, json [default], xml + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// The method will return all the attributes below with regard to user privileges in the format specified. Please note that the 'forms' attribute is the only attribute that contains sub-elements (one for each data collection instrument), in which each form will have its own Form Rights value (see the key below to learn what each numerical value represents). Most user privilege attributes are boolean (0=No Access, 1=Access). Attributes returned: + /// username, email, firstname, lastname, expiration, data_access_group, design, user_rights, data_access_groups, data_export, reports, stats_and_charts, manage_survey_participants, calendar, data_import_tool, data_comparison_tool, logging, file_repository, data_quality_create, data_quality_execute, api_export, api_import, mobile_app, mobile_app_download_data, record_create, record_rename, record_delete, lock_records_customization, lock_records, lock_records_all_forms, forms + /// + Task ExportUsersAsync(string token, Content content = Content.User, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + /// + /// From Redcap Version 4.7.0
+ /// + /// Export Users
+ /// This method allows you to export the list of users for a project, including their user privileges and also email address, first name, and last name. Note: If the user has been assigned to a user role, it will return the user with the role's defined privileges. + ///
+ /// + /// To use this method, you must have API Export privileges in the project. + /// KEY: Data Export: 0=No Access, 2=De-Identified, 1=Full Data Set + /// Form Rights: 0=No Access, 2=Read Only, 1=View records/responses and edit records(survey responses are read-only), 3=Edit survey responses + /// Other attribute values: 0=No Access, 1=Access. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// csv, json [default], xml + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// The method will return all the attributes below with regard to user privileges in the format specified. Please note that the 'forms' attribute is the only attribute that contains sub-elements (one for each data collection instrument), in which each form will have its own Form Rights value (see the key below to learn what each numerical value represents). Most user privilege attributes are boolean (0=No Access, 1=Access). Attributes returned: + /// username, email, firstname, lastname, expiration, data_access_group, design, user_rights, data_access_groups, data_export, reports, stats_and_charts, manage_survey_participants, calendar, data_import_tool, data_comparison_tool, logging, file_repository, data_quality_create, data_quality_execute, api_export, api_import, mobile_app, mobile_app_download_data, record_create, record_rename, record_delete, lock_records_customization, lock_records, lock_records_all_forms, forms + + Task ExportUsersAsync(string token, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + + /// + /// From Redcap Version 4.7.0

+ /// + /// Import Users

+ /// This method allows you to import new users into a project while setting their user privileges, or update the privileges of existing users in the project. + ///
+ /// + /// To use this method, you must have API Import/Update privileges *and* User Rights privileges in the project. + /// + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// user + /// + /// Contains the attributes of the user to be added to the project or whose privileges in the project are being updated, in which they are provided in the specified format. All values should be numerical with the exception of username, expiration, data_access_group, and forms. Please note that the 'forms' attribute is the only attribute that contains sub-elements (one for each data collection instrument), in which each form will have its own Form Rights value (see the key below to learn what each numerical value represents). Most user privilege attributes are boolean (0=No Access, 1=Access). Please notice the distinction between data_access_group (contains the unique DAG name for a user) and data_access_groups (denotes whether the user has access to the Data Access Groups page). + /// Missing attributes: If a user is being added to a project in the API request, then any attributes not provided for a user in the request(including form-level rights) will automatically be given the minimum privileges(typically 0=No Access) for the attribute/privilege.However, if an existing user's privileges are being modified in the API request, then any attributes not provided will not be modified from their current value but only the attributes provided in the request will be modified. + /// Data Export: 0=No Access, 2=De-Identified, 1=Full Data Set + /// Form Rights: 0=No Access, 2=Read Only, 1=View records/responses and edit records(survey responses are read-only), 3=Edit survey responses + /// Other attribute values: 0=No Access, 1=Access. + /// All available attributes: + /// username, expiration, data_access_group, design, user_rights, data_access_groups, data_export, reports, stats_and_charts, manage_survey_participants, calendar, data_import_tool, data_comparison_tool, logging, file_repository, data_quality_create, data_quality_execute, api_export, api_import, mobile_app, mobile_app_download_data, record_create, record_rename, record_delete, lock_records_customization, lock_records, lock_records_all_forms, forms + /// + /// + /// JSON Example: + /// [{"username":"harrispa","expiration":"","data_access_group":"","design":"1","user_rights":"1","data_access_groups":"1","data_export":"1","reports":"1","stats_and_charts":"1", + /// "manage_survey_participants":"1","calendar":"1","data_import_tool":"1","data_comparison_tool":"1", + /// "logging":"1","file_repository":"1","data_quality_create":"1","data_quality_execute":"1", + /// "api_export":"1","api_import":"1","mobile_app":"1","mobile_app_download_data":"0","record_create":"1", + /// "record_rename":"0","record_delete":"0","lock_records_all_forms":"0","lock_records":"0", + /// "lock_records_customization":"0","forms":{"demographics":"1","day_3":"1","other":"1"} + /// },{"username":"taylorr4","expiration":"2015-12-07","data_access_group":"","design":"0", + /// "user_rights":"0","data_access_groups":"0","data_export":"2","reports":"1","stats_and_charts":"1", + /// "manage_survey_participants":"1","calendar":"1","data_import_tool":"0", + /// "data_comparison_tool":"0","logging":"0","file_repository":"1","data_quality_create":"0", + /// "data_quality_execute":"0","api_export":"0","api_import":"0","mobile_app":"0", + /// "mobile_app_download_data":"0","record_create":"1","record_rename":"0","record_delete":"0", + /// "lock_records_all_forms":"0","lock_records":"0","lock_records_customization":"0", + /// "forms":{"demographics":"1","day_3":"2","other":"0"}}] + /// + /// csv, json [default], xml + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// Number of users added or updated + + Task ImportUsersAsync(string token, Content content, List data, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + + /// + /// From Redcap Version 4.7.0
+ /// + /// Import Users
+ /// This method allows you to import new users into a project while setting their user privileges, or update the privileges of existing users in the project. + ///
+ /// + /// To use this method, you must have API Import/Update privileges *and* User Rights privileges in the project. + /// + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// + /// Contains the attributes of the user to be added to the project or whose privileges in the project are being updated, in which they are provided in the specified format. All values should be numerical with the exception of username, expiration, data_access_group, and forms. Please note that the 'forms' attribute is the only attribute that contains sub-elements (one for each data collection instrument), in which each form will have its own Form Rights value (see the key below to learn what each numerical value represents). Most user privilege attributes are boolean (0=No Access, 1=Access). Please notice the distinction between data_access_group (contains the unique DAG name for a user) and data_access_groups (denotes whether the user has access to the Data Access Groups page). + /// Missing attributes: If a user is being added to a project in the API request, then any attributes not provided for a user in the request(including form-level rights) will automatically be given the minimum privileges(typically 0=No Access) for the attribute/privilege.However, if an existing user's privileges are being modified in the API request, then any attributes not provided will not be modified from their current value but only the attributes provided in the request will be modified. + /// Data Export: 0=No Access, 2=De-Identified, 1=Full Data Set + /// Form Rights: 0=No Access, 2=Read Only, 1=View records/responses and edit records(survey responses are read-only), 3=Edit survey responses + /// Other attribute values: 0=No Access, 1=Access. + /// All available attributes: + /// username, expiration, data_access_group, design, user_rights, data_access_groups, data_export, reports, stats_and_charts, manage_survey_participants, calendar, data_import_tool, data_comparison_tool, logging, file_repository, data_quality_create, data_quality_execute, api_export, api_import, mobile_app, mobile_app_download_data, record_create, record_rename, record_delete, lock_records_customization, lock_records, lock_records_all_forms, forms + /// + /// + /// JSON Example: + /// [{"username":"harrispa","expiration":"","data_access_group":"","design":"1","user_rights":"1","data_access_groups":"1","data_export":"1","reports":"1","stats_and_charts":"1", + /// "manage_survey_participants":"1","calendar":"1","data_import_tool":"1","data_comparison_tool":"1", + /// "logging":"1","file_repository":"1","data_quality_create":"1","data_quality_execute":"1", + /// "api_export":"1","api_import":"1","mobile_app":"1","mobile_app_download_data":"0","record_create":"1", + /// "record_rename":"0","record_delete":"0","lock_records_all_forms":"0","lock_records":"0", + /// "lock_records_customization":"0","forms":{"demographics":"1","day_3":"1","other":"1"} + /// },{"username":"taylorr4","expiration":"2015-12-07","data_access_group":"","design":"0", + /// "user_rights":"0","data_access_groups":"0","data_export":"2","reports":"1","stats_and_charts":"1", + /// "manage_survey_participants":"1","calendar":"1","data_import_tool":"0", + /// "data_comparison_tool":"0","logging":"0","file_repository":"1","data_quality_create":"0", + /// "data_quality_execute":"0","api_export":"0","api_import":"0","mobile_app":"0", + /// "mobile_app_download_data":"0","record_create":"1","record_rename":"0","record_delete":"0", + /// "lock_records_all_forms":"0","lock_records":"0","lock_records_customization":"0", + /// "forms":{"demographics":"1","day_3":"2","other":"0"}}] + /// + /// csv, json [default], xml + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// Number of users added or updated + Task ImportUsersAsync(string token, List data, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); #endregion #region User Roles - Task ExportUserRolesAsync(string token, Content content = Content.UserRole, ReturnFormat format = ReturnFormat.json, OnErrorFormat onErrorFormat = OnErrorFormat.json); - Task ImportUserRolesAsync(string token, List data, Content content = Content.UserRole, ReturnFormat format = ReturnFormat.json, OnErrorFormat onErrorFormat = OnErrorFormat.json); + /// + /// From Redcap Version 11.3.0

+ /// + /// Export User Roles

+ /// This method allows you to export the list of user roles for a project, including their user privileges. + ///
+ /// + /// To use this method, you must have API Export privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// userRole + /// csv, json [default], xml + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// The method will return all the attributes below with regard to user roles privileges in the format specified. Please note that the 'forms' attribute is the only attribute that contains sub-elements (one for each data collection instrument), in which each form will have its own Form Rights value (see the key below to learn what each numerical value represents). + /// Most user role privilege attributes are boolean (0=No Access, 1=Access). Attributes returned: + /// unique_role_name, role_label, design, user_rights, data_access_groups, data_export, reports, stats_and_charts, manage_survey_participants, calendar, data_import_tool, data_comparison_tool, logging, file_repository, data_quality_create, data_quality_execute, api_export, api_import, mobile_app, mobile_app_download_data, record_create, record_rename, record_delete, lock_records_customization, lock_records, lock_records_all_forms, forms + /// KEY:
+ /// Data Export:

+ /// 0=No Access,
+ /// 2=De-Identified,

+ /// 1=Full Data Set + ///

+ /// Form Rights:
+ /// 0=No Access,
+ /// 2=Read Only,
+ /// 1=View records/responses and edit records (survey responses are read-only),
+ /// 3=Edit survey responses

+ /// Other attribute values:
+ /// 0=No Access,
+ /// 1=Access. + ///
+ /// + /// + /// + Task ExportUserRolesAsync(string token, Content content = Content.UserRole, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + /// + /// From Redcap Version 11.3.0

+ /// + /// Import User Roles

+ /// This method allows you to import new user roles into a project while setting their privileges, or update the privileges of existing user roles in the project + ///
+ /// + /// To use this method, you must have API Import/Update privileges *and* User Rights privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// + /// Contains the attributes of the user role to be added to the project or whose privileges in the project are being updated, in which they are provided in the specified format. All values should be numerical with the exception of unique_role_name, role_label and forms. Please note that the 'forms' attribute is the only attribute that contains sub-elements (one for each data collection instrument), in which each form will have its own Form Rights value (see the key below to learn what each numerical value represents). Most user privilege attributes are boolean (0=No Access, 1=Access). + /// Missing attributes: If a user role is being added to a project in the API request, then any attributes not provided for a user role in the request(including form-level rights) will automatically be given the minimum privileges(typically 0=No Access) for the attribute/privilege.However, if an existing user role's privileges are being modified in the API request, then any attributes not provided will not be modified from their current value but only the attributes provided in the request will be modified. + /// Data Export: 0=No Access, 2=De-Identified, 1=Full Data Set + /// Form Rights: 0=No Access, 2=Read Only, 1=View records/responses and edit records(survey responses are read-only), 3=Edit survey responses + /// Other attribute values: 0=No Access, 1=Access. + /// All available attributes: unique_role_name, role_label, design, user_rights, data_access_groups, data_export, reports, stats_and_charts, manage_survey_participants, calendar, data_import_tool, data_comparison_tool, logging, file_repository, data_quality_create, data_quality_execute, api_export, api_import, mobile_app, mobile_app_download_data, record_create, record_rename, record_delete, lock_records_customization, lock_records, lock_records_all_forms, forms + /// + /// userRole + /// csv, json [default], xml + /// csv, json, xml - specifies the format of error messages. If you do not pass in this flag, it will select the default format for you passed based on the 'format' flag you passed in or if no format flag was passed in, it will default to 'json'. + /// Number of user roles added or updated + + Task ImportUserRolesAsync(string token, List data, Content content = Content.UserRole, RedcapFormat format = RedcapFormat.json, RedcapReturnFormat returnFormat = RedcapReturnFormat.json); + /// + /// From Redcap Version 11.3.0

+ /// + /// Delete User Roles

+ /// This method allows you to delete User Roles from a project. + ///
+ /// + /// To use this method, you must have API Import/Update privileges *and* User Rights privileges in the project. + /// + /// The API token specific to your REDCap project and username (each token is unique to each user for each project). See the section on the left-hand menu for obtaining a token for a given project. + /// an array of unique rolenames that you wish to delete + /// userRole + /// delete + /// Number of User Roles deleted Task DeleteUserRolesAsync(string token, List roles, Content content = Content.UserRole, RedcapAction action = RedcapAction.Delete); #endregion } diff --git a/RedcapApi/Models/Format.cs b/RedcapApi/Models/Format.cs deleted file mode 100644 index 316c601..0000000 --- a/RedcapApi/Models/Format.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace Redcap.Models -{ - /// - /// The format that the response object should be when returned from the http request. - /// Format, 0 = JSON - /// Format, 1 = CSV - /// Format, 2 = XML - /// - public enum ReturnFormat - { - /// - /// Default Javascript Notation - /// - /// - [Display(Name = "json")] - json = 0, - /// - /// Comma Seperated Values - /// - /// - [Display(Name = "csv")] - csv = 1, - /// - /// Extensible Markup Language - /// - /// - [Display(Name = "xml")] - xml = 2, - /// - /// CDISC ODM XML format, specifically ODM version 1.3.1 - /// Only usable on Project Create - /// - /// - [Display(Name = "odm")] - odm = 3 - } -} diff --git a/RedcapApi/Models/RedcapFormat.cs b/RedcapApi/Models/RedcapFormat.cs index c05c71c..523acb4 100644 --- a/RedcapApi/Models/RedcapFormat.cs +++ b/RedcapApi/Models/RedcapFormat.cs @@ -8,10 +8,11 @@ namespace Redcap.Models /// Format, 0 = json /// Format, 1 = csv [default] /// Format, 2 = xml + ///
+ /// public enum RedcapFormat { - ///
/// /// Default Javascript Notation /// diff --git a/RedcapApi/Models/RedcapReturnFormat.cs b/RedcapApi/Models/RedcapReturnFormat.cs index b89bd6d..a07b575 100644 --- a/RedcapApi/Models/RedcapReturnFormat.cs +++ b/RedcapApi/Models/RedcapReturnFormat.cs @@ -6,14 +6,14 @@ namespace Redcap.Models /// Specifies the format of error messages /// /// The format that the response object should be if there are errors generated when executing the http request. - /// OnErrorFormat, 0 = json - /// OnErrorFormat, 1 = csv - /// OnErrorFormat, 2 = xml + /// ReturnFormat, 0 = json + /// ReturnFormat, 1 = csv + /// ReturnFormat, 2 = xml + ///
/// public enum RedcapReturnFormat { - ///
/// /// Default Javascript Notation /// diff --git a/RedcapApi/Models/RedcapUser.cs b/RedcapApi/Models/RedcapUser.cs index c76f6f7..95475b5 100644 --- a/RedcapApi/Models/RedcapUser.cs +++ b/RedcapApi/Models/RedcapUser.cs @@ -2,89 +2,177 @@ namespace Redcap.Models { + /// + /// Redcap User Class + /// public class RedcapUser { + /// + /// username + /// [Display(Name = "username")] public string Username { get; set; } + /// + /// expiration date + /// [Display(Name = "expiration")] public string Expiration { get; set; } + /// + /// data access group + /// [Display(Name = "data_access_group")] public string DataAccessGroup { get; set; } + /// + /// design + /// [Display(Name = "design")] public string Design { get; set; } + /// + /// user rights + /// [Display(Name = "user_rights")] public string UserRights { get; set; } + /// + /// data access groups + /// [Display(Name = "data_access_groups")] public string DataAccessGroups { get; set; } + /// + /// data export + /// [Display(Name = "data_export")] public string DataExport { get; set; } + /// + /// reports + /// [Display(Name = "reports")] public string Reports { get; set; } + /// + /// stats and charts + /// [Display(Name = "stats_and_charts")] public string StatsAndCharts { get; set; } + /// + /// manage survey participants + /// [Display(Name = "manage_survey_participants")] public string ManageSurveyParticipants { get; set; } + /// + /// calendar + /// [Display(Name = "calendar")] public string Calendar { get; set; } + /// + /// data import tool + /// [Display(Name = "data_import_tool")] public string DataImportTool { get; set; } + /// + /// data comparison tool + /// [Display(Name = "data_comparison_tool")] public string DataComparisonTool { get; set; } + /// + /// logging + /// [Display(Name = "logging")] public string Logging { get; set; } + + /// + /// file repository + /// [Display(Name = "file_repository")] public string FileRepository { get; set; } + /// + /// data quality create + /// [Display(Name = "data_quality_create")] public string DataQualityCreate { get; set; } + /// + /// data quality execute + /// [Display(Name = "data_quality_execute")] public string DataQualityExecute { get; set; } + /// + /// api export + /// [Display(Name = "api_export")] public string ApiExport { get; set; } + /// + /// api import + /// [Display(Name = "api_import")] public string ApiImport { get; set; } + /// + /// mobile app + /// [Display(Name = "mobile_app")] public string MobileApp { get; set; } + /// + /// record create tool + /// [Display(Name ="record_create_tool")] public string RecordCreateTool { get; set; } + /// + /// mobile app download data + /// [Display(Name = "mobile_app_download_data")] public string MobileAppDownloadData { get; set; } + /// + /// record create + /// [Display(Name = "record_create")] public string RecordCreate { get; set; } + /// + /// record rename + /// [Display(Name = "record_rename")] public string RecordRename { get; set; } + /// + /// record delete + /// [Display(Name = "record_delete")] public string RecordDelete { get; set; } + /// + /// lock records all forms + /// [Display(Name = "lock_records_all_forms")] public string LockRecordsAllForms { get; set; } + /// + /// lock records + /// [Display(Name = "lock_records")] public string LockRecords { get; set; } + /// + /// lock records customization + /// [Display(Name = "lock_records_customization")] public string LockRecordsCustomization { get; set; } } diff --git a/RedcapApi/Redcap.csproj b/RedcapApi/Redcap.csproj index e817a8a..5bb122b 100644 --- a/RedcapApi/Redcap.csproj +++ b/RedcapApi/Redcap.csproj @@ -10,20 +10,20 @@ This library allows applications on the .NET platform to make http calls to REDCap instances. Redcap Api Library RedcapAPI - 1.3.0 - 1.3.0 + 1.3.1 + 1.3.1 redcap api library vcu Library en - 1.3.0 + 1.3.1 https://github.com/cctrbic/redcap-api/blob/master/LICENSE.md https://vortex.cctr.vcu.edu/images/ram_crest_160.png vcu.png Redcap Api - - add new api methods for FileRepository -- update documentation + update api documentation, streamline api parameters to match official documentations README.md + True diff --git a/RedcapApi/Utilities/Utils.cs b/RedcapApi/Utilities/Utils.cs index 4a7d68d..6a6e0dc 100644 --- a/RedcapApi/Utilities/Utils.cs +++ b/RedcapApi/Utilities/Utils.cs @@ -211,11 +211,11 @@ public static async Task HandleReturnContent(this RedcapApi redcapApi, R /// /// /// tuple, string, string, string - public static async Task<(string format, string onErrorFormat, string redcapDataType)> HandleFormat(this RedcapApi redcapApi, ReturnFormat? format = ReturnFormat.json, OnErrorFormat? onErrorFormat = OnErrorFormat.json, RedcapDataType? redcapDataType = RedcapDataType.flat) + public static async Task<(string format, string onErrorFormat, string redcapDataType)> HandleFormat(this RedcapApi redcapApi, RedcapFormat? format = RedcapFormat.json, RedcapReturnFormat? onErrorFormat = RedcapReturnFormat.json, RedcapDataType? redcapDataType = RedcapDataType.flat) { // default - var _format = ReturnFormat.json.ToString(); - var _onErrorFormat = OnErrorFormat.json.ToString(); + var _format = RedcapFormat.json.ToString(); + var _onErrorFormat = RedcapReturnFormat.json.ToString(); var _redcapDataType = RedcapDataType.flat.ToString(); try @@ -223,33 +223,33 @@ public static async Task HandleReturnContent(this RedcapApi redcapApi, R switch (format) { - case ReturnFormat.json: - _format = ReturnFormat.json.ToString(); + case RedcapFormat.json: + _format = RedcapFormat.json.ToString(); break; - case ReturnFormat.csv: - _format = ReturnFormat.csv.ToString(); + case RedcapFormat.csv: + _format = RedcapFormat.csv.ToString(); break; - case ReturnFormat.xml: - _format = ReturnFormat.xml.ToString(); + case RedcapFormat.xml: + _format = RedcapFormat.xml.ToString(); break; default: - _format = ReturnFormat.json.ToString(); + _format = RedcapFormat.json.ToString(); break; } switch (onErrorFormat) { - case OnErrorFormat.json: - _onErrorFormat = OnErrorFormat.json.ToString(); + case RedcapReturnFormat.json: + _onErrorFormat = RedcapReturnFormat.json.ToString(); break; - case OnErrorFormat.csv: - _onErrorFormat = OnErrorFormat.csv.ToString(); + case RedcapReturnFormat.csv: + _onErrorFormat = RedcapReturnFormat.csv.ToString(); break; - case OnErrorFormat.xml: - _onErrorFormat = OnErrorFormat.xml.ToString(); + case RedcapReturnFormat.xml: + _onErrorFormat = RedcapReturnFormat.xml.ToString(); break; default: - _onErrorFormat = OnErrorFormat.json.ToString(); + _onErrorFormat = RedcapReturnFormat.json.ToString(); break; } diff --git a/RedcapApiDemo/Program.cs b/RedcapApiDemo/Program.cs index 45b6a6e..9f80f0e 100644 --- a/RedcapApiDemo/Program.cs +++ b/RedcapApiDemo/Program.cs @@ -190,7 +190,7 @@ static async Task InitializeDemo() #region ExportLoggingAsync() Console.WriteLine("Calling ExportLoggingAsync() . . ."); Console.WriteLine($"Exporting logs for User . . ."); - var ExportLoggingAsync = await redcap_api_2_0_0.ExportLoggingAsync(_token, Content.Log, ReturnFormat.json, LogType.User); + var ExportLoggingAsync = await redcap_api_2_0_0.ExportLoggingAsync(_token, Content.Log, RedcapFormat.json, LogType.User); Console.WriteLine($"ExportLoggingAsync Results: {JsonConvert.DeserializeObject(ExportLoggingAsync)}"); Console.WriteLine("----------------------------Press Enter to Continue-------------"); Console.ReadLine(); @@ -201,7 +201,7 @@ static async Task InitializeDemo() Console.WriteLine("Calling ImportDagsAsync() . . ."); Console.WriteLine($"Importing Dags . . ."); var dags = CreateDags(5); - var ImportDagsAsyncResult = await redcap_api_2_0_0.ImportDagsAsync(_token, Content.Dag, RedcapAction.Import, ReturnFormat.json, dags); + var ImportDagsAsyncResult = await redcap_api_2_0_0.ImportDagsAsync(_token, Content.Dag, RedcapAction.Import, RedcapFormat.json, dags); Console.WriteLine($"ImportDagsAsync Results: {JsonConvert.DeserializeObject(ImportDagsAsyncResult)}"); Console.WriteLine("----------------------------Press Enter to Continue-------------"); Console.ReadLine(); @@ -211,7 +211,7 @@ static async Task InitializeDemo() #region ExportDagsAsync() Console.WriteLine("Calling ExportDagsAsync() . . ."); Console.WriteLine($"Exporting Dags . . ."); - var ExportDagsAsyncResult = await redcap_api_2_0_0.ExportDagsAsync(_token, Content.Dag, ReturnFormat.json); + var ExportDagsAsyncResult = await redcap_api_2_0_0.ExportDagsAsync(_token, Content.Dag, RedcapFormat.json); Console.WriteLine($"ExportDagsAsync Results: {JsonConvert.DeserializeObject(ExportDagsAsyncResult)}"); Console.WriteLine("----------------------------Press Enter to Continue-------------"); Console.ReadLine(); @@ -233,7 +233,7 @@ static async Task InitializeDemo() var importDemographicsData = CreateDemographics(includeBio: true, 5); Console.WriteLine("Serializing the data . . ."); Console.WriteLine($"Importing record {string.Join(",", importDemographicsData.Select(x => x.RecordId).ToList())} . . ."); - var ImportRecordsAsync = await redcap_api_2_0_0.ImportRecordsAsync(_token, Content.Record, ReturnFormat.json, RedcapDataType.flat, OverwriteBehavior.normal, false, importDemographicsData, "MDY", CsvDelimiter.tab, ReturnContent.count, OnErrorFormat.json); + var ImportRecordsAsync = await redcap_api_2_0_0.ImportRecordsAsync(_token, Content.Record, RedcapFormat.json, RedcapDataType.flat, OverwriteBehavior.normal, false, importDemographicsData, "MDY", CsvDelimiter.tab, ReturnContent.count, RedcapReturnFormat.json); var ImportRecordsAsyncData = JsonConvert.DeserializeObject(ImportRecordsAsync); Console.WriteLine($"ImportRecordsAsync Result: {ImportRecordsAsyncData}"); Console.WriteLine("----------------------------Press Enter to Continue-------------"); @@ -268,7 +268,7 @@ static async Task InitializeDemo() var recordToRename = importDemographicsData.Select(x => x.RecordId).SingleOrDefault(); Console.WriteLine($"Renaming record {recordToRename} . . ."); var newRecordName = "2"; - var RenameRecordAsyncResult = await redcap_api_2_0_0.RenameRecordAsync(_token, recordToRename, newRecordName, Content.Record, RedcapAction.Rename, 1); + var RenameRecordAsyncResult = await redcap_api_2_0_0.RenameRecordAsync(_token, Content.Record, RedcapAction.Rename,recordToRename, newRecordName, 1); var RenameRecordAsyncData = JsonConvert.DeserializeObject(RenameRecordAsyncResult); Console.WriteLine($"RenameRecordAsync Result: {DeleteRecordsAsyncData}"); @@ -286,7 +286,7 @@ static async Task InitializeDemo() redcapUsers.Add(redcapUser1); redcapUsers.Add(redcapUser2); Console.WriteLine($"Importing {redcapUsers.Count} user. . ."); - var ImportUsersAsyncResult = await redcap_api_2_0_0.ImportUsersAsync(_token, redcapUsers, ReturnFormat.json, OnErrorFormat.json); + var ImportUsersAsyncResult = await redcap_api_2_0_0.ImportUsersAsync(_token, redcapUsers, RedcapFormat.json, RedcapReturnFormat.json); var ImportUsersAsyncData = JsonConvert.DeserializeObject(ImportUsersAsyncResult); Console.WriteLine($"ImportUsersAsync Result: {ImportUsersAsyncData}"); Console.WriteLine("----------------------------Press Enter to Continue-------------"); @@ -297,7 +297,7 @@ static async Task InitializeDemo() #region ExportArmsAsync() var arms = new string[] { }; Console.WriteLine("Calling ExportArmsAsync()"); - var ExportArmsAsyncResult = await redcap_api_2_0_0.ExportArmsAsync(_token, Content.Arm, ReturnFormat.json, arms, OnErrorFormat.json); + var ExportArmsAsyncResult = await redcap_api_2_0_0.ExportArmsAsync(_token, Content.Arm, RedcapFormat.json, arms, RedcapReturnFormat.json); Console.WriteLine($"ExportArmsAsyncResult: {JsonConvert.DeserializeObject(ExportArmsAsyncResult)}"); #endregion ExportArmsAsync() @@ -307,7 +307,7 @@ static async Task InitializeDemo() #region ImportArmsAsync() var ImportArmsAsyncData = CreateArms(count: 3); Console.WriteLine("Calling ImportArmsAsync()"); - var ImportArmsAsyncResult = await redcap_api_2_0_0.ImportArmsAsync(_token, Content.Arm, Override.False, RedcapAction.Import, ReturnFormat.json, ImportArmsAsyncData, OnErrorFormat.json); + var ImportArmsAsyncResult = await redcap_api_2_0_0.ImportArmsAsync(_token, Content.Arm, Override.False, RedcapAction.Import, RedcapFormat.json, ImportArmsAsyncData, RedcapReturnFormat.json); Console.WriteLine($"ImportArmsAsyncResult: {JsonConvert.DeserializeObject(ImportArmsAsyncResult)}"); #endregion ImportArmsAsync() @@ -327,7 +327,7 @@ static async Task InitializeDemo() #region ExportEventsAsync() var ExportEventsAsyncData = new string[] { "1" }; Console.WriteLine("Calling ExportEventsAsync()"); - var ExportEventsAsyncResult = await redcap_api_2_0_0.ExportEventsAsync(_token, Content.Event, ReturnFormat.json, ExportEventsAsyncData, OnErrorFormat.json); + var ExportEventsAsyncResult = await redcap_api_2_0_0.ExportEventsAsync(_token, Content.Event, RedcapFormat.json, ExportEventsAsyncData, RedcapReturnFormat.json); Console.WriteLine($"ExportEventsAsyncResult: {JsonConvert.DeserializeObject(ExportEventsAsyncResult)}"); #endregion ExportEventsAsync() @@ -356,7 +356,7 @@ static async Task InitializeDemo() CustomEventLabel = "hello clinical" } }; - var ImportEventsAsyncResult = await redcap_api_2_0_0.ImportEventsAsync(_token, Content.Event, RedcapAction.Import, Override.False, ReturnFormat.json, eventList, OnErrorFormat.json); + var ImportEventsAsyncResult = await redcap_api_2_0_0.ImportEventsAsync(_token, Content.Event, RedcapAction.Import, Override.False, RedcapFormat.json, eventList, RedcapReturnFormat.json); Console.WriteLine($"ImportEventsAsyncResult: {ImportEventsAsyncResult}"); #endregion ImportEventsAsync() @@ -389,7 +389,7 @@ static async Task InitializeDemo() #region ExportFieldNamesAsync() Console.WriteLine("Calling ExportFieldNamesAsync(), first_name"); - var ExportFieldNamesAsyncResult = await redcap_api_2_0_0.ExportFieldNamesAsync(_token, Content.ExportFieldNames, ReturnFormat.json, "first_name", OnErrorFormat.json); + var ExportFieldNamesAsyncResult = await redcap_api_2_0_0.ExportFieldNamesAsync(_token, Content.ExportFieldNames, RedcapFormat.json, "first_name", RedcapReturnFormat.json); Console.WriteLine($"ExportFieldNamesAsyncResult: {ExportFieldNamesAsyncResult}"); #endregion ExportFieldNamesAsync() @@ -405,7 +405,7 @@ static async Task InitializeDemo() var parent = Directory.GetParent(parentDirectory).FullName; var filePath = Directory.GetParent(parent).FullName + @"\Docs\"; Console.WriteLine($"Calling ImportFileAsync(), {fileName}"); - var ImportFileAsyncResult = await redcap_api_2_0_0.ImportFileAsync(_token, Content.File, RedcapAction.Import, recordId, fieldName, eventName, null, fileName, filePath, OnErrorFormat.json); + var ImportFileAsyncResult = await redcap_api_2_0_0.ImportFileAsync(_token, Content.File, RedcapAction.Import, recordId, fieldName, eventName, null, fileName, filePath, RedcapReturnFormat.json); Console.WriteLine($"ImportFileAsyncResult: {ImportFileAsyncResult}"); #endregion ImportFileAsync() @@ -415,7 +415,7 @@ static async Task InitializeDemo() #region ExportFileAsync() Console.WriteLine($"Calling ExportFileAsync(), {fileName} for field name {fieldName}, not save the file."); - var ExportFileAsyncResult = await redcap_api_2_0_0.ExportFileAsync(_token, Content.File, RedcapAction.Export, recordId, fieldName, eventName, null, OnErrorFormat.json); + var ExportFileAsyncResult = await redcap_api_2_0_0.ExportFileAsync(_token, Content.File, RedcapAction.Export, recordId, fieldName, eventName, null, RedcapReturnFormat.json); Console.WriteLine($"ExportFileAsyncResult: {ExportFileAsyncResult}"); #endregion ExportFileAsync() @@ -425,7 +425,7 @@ static async Task InitializeDemo() #region ExportFileAsync() var filedDownloadPath = @"C:\redcap_download_files"; Console.WriteLine($"Calling ExportFileAsync(), {fileName} for field name {fieldName}, saving the file."); - var ExportFileAsyncResult2 = await redcap_api_2_0_0.ExportFileAsync(_token, Content.File, RedcapAction.Export, recordId, fieldName, eventName, null, OnErrorFormat.json, filedDownloadPath); + var ExportFileAsyncResult2 = await redcap_api_2_0_0.ExportFileAsync(_token, Content.File, RedcapAction.Export, recordId, fieldName, eventName, null, RedcapReturnFormat.json, filedDownloadPath); Console.WriteLine($"ExportFileAsyncResult2: {ExportFileAsyncResult2}"); #endregion ExportFileAsync() @@ -434,7 +434,7 @@ static async Task InitializeDemo() #region DeleteFileAsync() Console.WriteLine($"Calling DeleteFileAsync(), deleting file: {fileName} for field: {fieldName}"); - var DeleteFileAsyncResult = await redcap_api_2_0_0.DeleteFileAsync(_token, Content.File, RedcapAction.Delete, recordId, fieldName, eventName, "1", OnErrorFormat.json); + var DeleteFileAsyncResult = await redcap_api_2_0_0.DeleteFileAsync(_token, Content.File, RedcapAction.Delete, recordId, fieldName, eventName, "1", RedcapReturnFormat.json); Console.WriteLine($"DeleteFileAsyncResult: {DeleteFileAsyncResult}"); #endregion DeleteFileAsync() @@ -443,7 +443,7 @@ static async Task InitializeDemo() #region ExportInstrumentsAsync() Console.WriteLine($"Calling DeleteFileAsync()"); - var ExportInstrumentsAsyncResult = await redcap_api_2_0_0.ExportInstrumentsAsync(_token, Content.Instrument, ReturnFormat.json); + var ExportInstrumentsAsyncResult = await redcap_api_2_0_0.ExportInstrumentsAsync(_token, Content.Instrument, RedcapFormat.json); Console.WriteLine($"ExportInstrumentsAsyncResult: {ExportInstrumentsAsyncResult}"); #endregion ExportInstrumentsAsync() @@ -461,7 +461,7 @@ static async Task InitializeDemo() #region ExportPDFInstrumentsAsync() Console.WriteLine($"Calling ExportPDFInstrumentsAsync(), saving pdf file to {filedDownloadPath}"); - var ExportPDFInstrumentsAsyncResult2 = await redcap_api_2_0_0.ExportPDFInstrumentsAsync(_token, recordId, eventName, "demographics", true, filedDownloadPath, OnErrorFormat.json); + var ExportPDFInstrumentsAsyncResult2 = await redcap_api_2_0_0.ExportPDFInstrumentsAsync(_token, recordId, eventName, "demographics", true, filedDownloadPath, RedcapReturnFormat.json); Console.WriteLine($"ExportPDFInstrumentsAsyncResult2: {ExportPDFInstrumentsAsyncResult2}"); #endregion ExportPDFInstrumentsAsync() @@ -481,7 +481,7 @@ static async Task InitializeDemo() #region ImportInstrumentMappingAsync() var importInstrumentMappingData = new List { new FormEventMapping { arm_num = "1", unique_event_name = "clinical_arm_1", form = "demographics" } }; Console.WriteLine($"Calling ImportInstrumentMappingAsync()"); - var ImportInstrumentMappingAsyncResult = await redcap_api_2_0_0.ImportInstrumentMappingAsync(_token, Content.FormEventMapping, ReturnFormat.json, importInstrumentMappingData, OnErrorFormat.json); + var ImportInstrumentMappingAsyncResult = await redcap_api_2_0_0.ImportInstrumentMappingAsync(_token, Content.FormEventMapping, RedcapFormat.json, importInstrumentMappingData, RedcapReturnFormat.json); Console.WriteLine($"ImportInstrumentMappingAsyncResult: {ImportInstrumentMappingAsyncResult}"); #endregion ImportInstrumentMappingAsync() @@ -490,7 +490,7 @@ static async Task InitializeDemo() #region ExportMetaDataAsync() Console.WriteLine($"Calling ExportMetaDataAsync()"); - var ExportMetaDataAsyncResult = await redcap_api_2_0_0.ExportMetaDataAsync(_token, Content.MetaData, ReturnFormat.json, null, null, OnErrorFormat.json); + var ExportMetaDataAsyncResult = await redcap_api_2_0_0.ExportMetaDataAsync(_token, Content.MetaData, RedcapFormat.json, null, null, RedcapReturnFormat.json); Console.WriteLine($"ExportMetaDataAsyncResult: {ExportMetaDataAsyncResult}"); #endregion ExportMetaDataAsync() @@ -514,7 +514,7 @@ static async Task InitializeDemo() var projectData = new List { new RedcapProject { project_title = "Amazing Project ", purpose = ProjectPurpose.Other, purpose_other = "Test" } }; Console.WriteLine($"Calling CreateProjectAsync(), creating a new project with Amazing Project as title, purpose 1 (other) "); Console.WriteLine($"-----------------------Notice the use of SUPER TOKEN------------------------"); - var CreateProjectAsyncResult = await redcap_api_2_0_0.CreateProjectAsync(_superToken, Content.Project, ReturnFormat.json, projectData, OnErrorFormat.json, null); + var CreateProjectAsyncResult = await redcap_api_2_0_0.CreateProjectAsync(_superToken, Content.Project, RedcapFormat.json, projectData, RedcapReturnFormat.json, null); Console.WriteLine($"CreateProjectAsyncResult: {CreateProjectAsyncResult}"); #endregion CreateProjectAsync() Console.WriteLine("----------------------------Press Enter to Continue-------------"); @@ -523,7 +523,7 @@ static async Task InitializeDemo() #region ImportProjectInfoAsync() var projectInfo = new RedcapProjectInfo { ProjectTitle = "Updated Amazing Project ", Purpose = ProjectPurpose.QualityImprovement, SurveysEnabled = 1 }; Console.WriteLine($"Calling ImportProjectInfoAsync()"); - var ImportProjectInfoAsyncResult = await redcap_api_2_0_0.ImportProjectInfoAsync(_token, Content.ProjectSettings, ReturnFormat.json, projectInfo); + var ImportProjectInfoAsyncResult = await redcap_api_2_0_0.ImportProjectInfoAsync(_token, Content.ProjectSettings, RedcapFormat.json, projectInfo); Console.WriteLine($"ImportProjectInfoAsyncResult: {ImportProjectInfoAsyncResult}"); #endregion ImportProjectInfoAsync() Console.WriteLine("----------------------------Press Enter to Continue-------------"); @@ -531,7 +531,7 @@ static async Task InitializeDemo() #region ExportProjectInfoAsync() Console.WriteLine($"Calling ExportProjectInfoAsync()"); - var ExportProjectInfoAsyncResult = await redcap_api_2_0_0.ExportProjectInfoAsync(_token, Content.ProjectSettings, ReturnFormat.json); + var ExportProjectInfoAsyncResult = await redcap_api_2_0_0.ExportProjectInfoAsync(_token, Content.ProjectSettings, RedcapFormat.json); Console.WriteLine($"ExportProjectInfoAsyncResult: {ExportProjectInfoAsyncResult}"); #endregion ExportProjectInfoAsync() From ec2171b78e0e2a3deecb74be7d7f26acc23c4852 Mon Sep 17 00:00:00 2001 From: Michael Tran Date: Mon, 9 Jan 2023 03:08:01 -0500 Subject: [PATCH 2/3] Update RedcapApi.cs --- RedcapApi/Api/RedcapApi.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/RedcapApi/Api/RedcapApi.cs b/RedcapApi/Api/RedcapApi.cs index 6948e26..9656055 100644 --- a/RedcapApi/Api/RedcapApi.cs +++ b/RedcapApi/Api/RedcapApi.cs @@ -5091,8 +5091,5 @@ public async Task ImportUserRoleAssignmentAsync(string token, List } } #endregion User Roles - - - } } From 0823374b52ed9ed47990d7f094a102dc633abd4a Mon Sep 17 00:00:00 2001 From: Michael Tran Date: Mon, 9 Jan 2023 03:13:11 -0500 Subject: [PATCH 3/3] version bump --- README.md | 6 +++--- RedcapApi/Redcap.csproj | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index dbefcd3..215e4bf 100644 --- a/README.md +++ b/README.md @@ -80,21 +80,21 @@ __Install directly in Package Manager Console or Command Line Interface__ ```C# Package Manager -Install-Package RedcapAPI -Version 1.3.0 +Install-Package RedcapAPI -Version 1.3.1 ``` ```C# .NET CLI -dotnet add package RedcapAPI --version 1.3.0 +dotnet add package RedcapAPI --version 1.3.1 ``` ```C# Paket CLI -paket add RedcapAPI --version 1.3.0 +paket add RedcapAPI --version 1.3.1 ``` diff --git a/RedcapApi/Redcap.csproj b/RedcapApi/Redcap.csproj index 5bb122b..4e48641 100644 --- a/RedcapApi/Redcap.csproj +++ b/RedcapApi/Redcap.csproj @@ -21,7 +21,10 @@ https://vortex.cctr.vcu.edu/images/ram_crest_160.png vcu.png Redcap Api - update api documentation, streamline api parameters to match official documentations + -update api documentation, +-multiple breaking changes +-fix some apis where parameters were behind the releases +-streamline api parameters to match official documentations README.md True