2 changed files
RedcapApi/Api | ||
Redcap.cs | ||
Tests | ||
RedcapApiTests.cs | ||
Displayed content is truncated due to maximum viewable content limit.
Add comment 75 _uri = new Uri(redcapApiUrl);
Add comment 76 }
Add comment 77
Add comment 78 Minus #region API Version 1.0.0 Begin
Add comment 78 Plus #region API Version 1.0.0+ Begin
Add comment 79
Add comment 80 #region Arms
Add comment 81 /// <summary>
Add comment 82 Minus /// API Version 1.0.0 **
Add comment 82 Plus /// API Version 1.0.0+ **
Add comment 83 /// Export Arms
Add comment 84 /// This method allows you to export the Arms for a project
Add comment 85 /// NOTE: This only works for longitudinal projects.
Add comment 135 }
Add comment 136
Add comment 137 /// <summary>
Add comment 138 Minus /// API Version 1.0.0 **
Add comment 138 Plus /// API Version 1.0.0+ **
Add comment 139 /// Export Arms
Add comment 140 /// This method allows you to export the Arms for a project
Add comment 141 /// NOTE: This only works for longitudinal projects.
Add comment 192 }
Add comment 193
Add comment 194 /// <summary>
Add comment 195 Minus /// API Version 1.0.0
Add comment 195 Plus /// API Version 1.0.0+
Add comment 196 /// From Redcap Version 6.11.0
Add comment 197 ///
Add comment 198 /// Import Arms
Add comment 251 }
Add comment 252
Add comment 253 /// <summary>
Add comment 254 Minus /// API Version 1.0.0
Add comment 254 Plus /// API Version 1.0.0+
Add comment 255 /// From Redcap Version 6.11.0
Add comment 256 ///
Add comment 257 /// Import Arms
Add comment 311 }
Add comment 312
Add comment 313 /// <summary>
Add comment 314 Minus /// API Version 1.0.0
Add comment 314 Plus /// API Version 1.0.0+
Add comment 315 /// From Redcap Version 6.11.0
Add comment 316 ///
Add comment 317 /// Delete Arms
Add comment 364 }
Add comment 365
Add comment 366 /// <summary>
Add comment 367 Minus /// API Version 1.0.0
Add comment 367 Plus /// API Version 1.0.0+
Add comment 368 /// From Redcap Version 6.11.0
Add comment 369 ///
Add comment 370 /// Delete Arms
Add comment 421 #region Events
Add comment 422
Add comment 423 /// <summary>
Add comment 424 Minus /// API Version 1.0.0
Add comment 424 Plus /// API Version 1.0.0+
Add comment 425 /// From Redcap Version 6.11.0
Add comment 426 ///
Add comment 427 /// Export Events
Add comment 482 }
Add comment 483
Add comment 484 /// <summary>
Add comment 485 Minus /// API Version 1.0.0
Add comment 485 Plus /// API Version 1.0.0+
Add comment 486 /// From Redcap Version 6.11.0
Add comment 487 ///
Add comment 488 /// Export Events
Add comment 544 }
Add comment 545
Add comment 546 /// <summary>
Add comment 547 Minus /// API Version 1.0.0
Add comment 547 Plus /// API Version 1.0.0+
Add comment 548 /// From Redcap Version 6.11.0
Add comment 549 ///
Add comment 550 /// Import Events
Add comment 606 }
Add comment 607
Add comment 608 /// <summary>
Add comment 609 Minus /// API Version 1.0.0
Add comment 609 Plus /// API Version 1.0.0+
Add comment 610 /// From Redcap Version 6.11.0
Add comment 611 ///
Add comment 612 /// Import Events
Add comment 670 }
Add comment 671
Add comment 672 /// <summary>
Add comment 673 Minus /// API Version 1.0.0
Add comment 673 Plus /// API Version 1.0.0+
Add comment 674 /// From Redcap Version 6.11.0
Add comment 675 ///
Add comment 676 /// Delete Events
Add comment 728 }
Add comment 729
Add comment 730 /// <summary>
Add comment 731 Minus /// API Version 1.0.0
Add comment 731 Plus /// API Version 1.0.0+
Add comment 732 /// From Redcap Version 6.11.0
Add comment 733 ///
Add comment 734 /// Delete Events
Add comment 906 #region Files
Add comment 907
Add comment 908 /// <summary>
Add comment 909 Minus /// API Version 1.0.0
Add comment 909 Plus /// API Version 1.0.0+
Add comment 910 /// Export a File
Add comment 911 /// 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).
Add comment 912 /// 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.
Add comment 983 }
Add comment 984
Add comment 985 /// <summary>
Add comment 986 Minus /// API Version 1.0.0
Add comment 986 Plus /// API Version 1.0.0+
Add comment 987 /// Export a File
Add comment 988 /// **Allows for file download to a path.**
Add comment 989 /// 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).
Add comment 1055 }
Add comment 1056
Add comment 1057 /// <summary>
Add comment 1058 Minus /// API Version 1.0.0
Add comment 1058 Plus /// API Version 1.0.0+
Add comment 1059 /// Import a File
Add comment 1060 /// 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.
Add comment 1061 /// </summary>
Add comment 1131 }
Add comment 1132
Add comment 1133 /// <summary>
Add comment 1134 Minus /// API Version 1.0.0
Add comment 1134 Plus /// API Version 1.0.0+
Add comment 1135 /// Import a File
Add comment 1136 /// 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.
Add comment 1137 /// </summary>
Add comment 1209 }
Add comment 1210
Add comment 1211 /// <summary>
Add comment 1212 Minus /// API Version 1.0.0
Add comment 1212 Plus /// API Version 1.0.0+
Add comment 1213 /// Delete a File
Add comment 1214 /// 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).
Add comment 1215 /// </summary>
Add comment 1265 }
Add comment 1266
Add comment 1267 /// <summary>
Add comment 1268 Minus /// API Version 1.0.0
Add comment 1268 Plus /// API Version 1.0.0+
Add comment 1269 /// Delete a File
Add comment 1270 /// 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).
Add comment 1271 /// </summary>
Add comment 1325 #region Instruments
Add comment 1326
Add comment 1327 /// <summary>
Add comment 1328 Minus /// API Version 1.0.0
Add comment 1328 Plus /// API Version 1.0.0+
Add comment 1329 /// Export Instruments (Data Entry Forms)
Add comment 1330 /// This method allows you to export a list of the data collection instruments for a project.
Add comment 1331 /// 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.
Add comment 1364 }
Add comment 1365
Add comment 1366 /// <summary>
Add comment 1367 Minus /// API Version 1.0.0
Add comment 1367 Plus /// API Version 1.0.0+
Add comment 1368 /// Export Instruments (Data Entry Forms)
Add comment 1369 /// This method allows you to export a list of the data collection instruments for a project.
Add comment 1370 /// 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.
Add comment 1404 }
Add comment 1405
Add comment 1406 /// <summary>
Add comment 1407 Minus /// API Version 1.0.0
Add comment 1407 Plus /// API Version 1.0.0+
Add comment 1408 /// Export PDF file of Data Collection Instruments (either as blank or with data)
Add comment 1409 /// 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).
Add comment 1410 /// 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).
Add comment 1466 }
Add comment 1467
Add comment 1468 /// <summary>
Add comment 1469 Minus /// API Version 1.0.0
Add comment 1469 Plus /// API Version 1.0.0+
Add comment 1470 /// Export PDF file of Data Collection Instruments (either as blank or with data)
Add comment 1471 /// 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).
Add comment 1472 /// 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).
Add comment 1529 }
Add comment 1530
Add comment 1531 /// <summary>
Add comment 1532 Minus /// API Version 1.0.0
Add comment 1532 Plus /// API Version 1.0.0+
Add comment 1533 /// **Allows for file download to a path.**
Add comment 1534 /// Export PDF file of Data Collection Instruments (either as blank or with data)
Add comment 1535 /// 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).
Add comment 1601 }
Add comment 1602
Add comment 1603 /// <summary>
Add comment 1604 Minus /// API Version 1.0.0
Add comment 1604 Plus /// API Version 1.0.0+
Add comment 1605 /// From Redcap Version 6.11.0
Add comment 1606 ///
Add comment 1607 /// Export Instrument-Event Mappings
Add comment 1653 }
Add comment 1654
Add comment 1655 /// <summary>
Add comment 1656 Minus /// API Version 1.0.0
Add comment 1656 Plus /// API Version 1.0.0+
Add comment 1657 /// From Redcap Version 6.11.0
Add comment 1658 ///
Add comment 1659 /// Export Instrument-Event Mappings
Add comment 1706 }
Add comment 1707
Add comment 1708 /// <summary>
Add comment 1709 Minus /// API Version 1.0.0
Add comment 1709 Plus /// API Version 1.0.0+
Add comment 1710 /// From Redcap Version 6.11.0
Add comment 1711 ///
Add comment 1712 /// Import Instrument-Event Mappings
Add comment 1759 }
Add comment 1760
Add comment 1761 /// <summary>
Add comment 1762 Minus /// API Version 1.0.0
Add comment 1762 Plus /// API Version 1.0.0+
Add comment 1763 /// From Redcap Version 6.11.0
Add comment 1764 ///
Add comment 1765 /// Import Instrument-Event Mappings
Add comment 1814 #endregion Instruments
Add comment 1815 #region Metadata
Add comment 1816 /// <summary>
Add comment 1817 Minus /// API Version 1.0.0
Add comment 1817 Plus /// API Version 1.0.0+
Add comment 1818 /// Export Metadata (Data Dictionary)
Add comment 1819 /// This method allows you to export the metadata for a project
Add comment 1820 /// </summary>
Add comment 1870 }
Add comment 1871 }
Add comment 1872 /// <summary>
Add comment 1873 Minus /// API Version 1.0.0
Add comment 1873 Plus /// API Version 1.0.0+
Add comment 1874 /// Export Metadata (Data Dictionary)
Add comment 1875 /// This method allows you to export the metadata for a project
Add comment 1876 /// </summary>
Add comment 1925 }
Add comment 1926 }
Add comment 1927 /// <summary>
Add comment 1928 Minus /// API Version 1.0.0
Add comment 1928 Plus /// API Version 1.0.0+
Add comment 1929 /// From Redcap Version 6.11.0
Add comment 1930 ///
Add comment 1931 /// Import Metadata (Data Dictionary)
Add comment 1971 }
Add comment 1972
Add comment 1973 /// <summary>
Add comment 1974 Minus /// API Version 1.0.0
Add comment 1974 Plus /// API Version 1.0.0+
Add comment 1975 /// From Redcap Version 6.11.0
Add comment 1976 ///
Add comment 1977 /// Import Metadata (Data Dictionary)
Add comment 2019 #endregion Metadata
Add comment 2020 #region Projects
Add comment 2021 /// <summary>
Add comment 2022 Minus /// API Version 1.0.0
Add comment 2022 Plus /// API Version 1.0.0+
Add comment 2023 /// From Redcap Version 6.11.0
Add comment 2024 ///
Add comment 2025 /// Create A New Project
Add comment 2080 }
Add comment 2081
Add comment 2082 /// <summary>
Add comment 2083 Minus /// API Version 1.0.0
Add comment 2083 Plus /// API Version 1.0.0+
Add comment 2084 /// From Redcap Version 6.11.0
Add comment 2085 ///
Add comment 2086 /// Create A New Project
Add comment 2142 }
Add comment 2143
Add comment 2144 /// <summary>
Add comment 2145 Minus /// API Version 1.0.0
Add comment 2145 Plus /// API Version 1.0.0+
Add comment 2146 /// Import Project Information
Add comment 2147 /// 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.
Add comment 2148 /// </summary>
Add comment 2187
Add comment 2188 }
Add comment 2189 /// <summary>
Add comment 2190 Minus /// API Version 1.0.0
Add comment 2190 Plus /// API Version 1.0.0+
Add comment 2191 /// Import Project Information
Add comment 2192 /// 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.
Add comment 2193 /// </summary>
Add comment 2232 }
Add comment 2233
Add comment 2234 /// <summary>
Add comment 2235 Minus /// API Version 1.0.0
Add comment 2235 Plus /// API Version 1.0.0+
Add comment 2236 /// Export Project Information
Add comment 2237 /// 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.
Add comment 2238 /// </summary>
Add comment 2276 }
Add comment 2277 }
Add comment 2278 /// <summary>
Add comment 2279 Minus /// API Version 1.0.0
Add comment 2279 Plus /// API Version 1.0.0+
Add comment 2280 /// Export Project Information
Add comment 2281 /// 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.
Add comment 2282 /// </summary>
Add comment 2320 }
Add comment 2321
Add comment 2322 /// <summary>
Add comment 2323 Minus /// API Version 1.0.0
Add comment 2323 Plus /// API Version 1.0.0+
Add comment 2324 /// From Redcap Version 6.12.0
Add comment 2325 ///
Add comment 2326 /// Export Entire Project as REDCap XML File (containing metadata and data)
Add comment 2400 }
Add comment 2401
Add comment 2402 /// <summary>
Add comment 2403 Minus /// API Version 1.0.0
Add comment 2403 Plus /// API Version 1.0.0+
Add comment 2404 /// From Redcap Version 6.12.0
Add comment 2405 ///
Add comment 2406 /// Export Entire Project as REDCap XML File (containing metadata and data)
Add comment 2481 #endregion Projects
Add comment 2482 #region Records
Add comment 2483 /// <summary>
Add comment 2484 Minus /// API Version 1.0.0
Add comment 2484 Plus /// API Version 1.0.0+
Add comment 2485 /// From Redcap Version 6.18.0
Add comment 2486 /// Generate Next Record Name
Add comment 2487 /// 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.
Add comment 2521 }
Add comment 2522
Add comment 2523 /// <summary>
Add comment 2524 Minus /// API Version 1.0.0
Add comment 2524 Plus /// API Version 1.0.0+
Add comment 2525 /// From Redcap Version 6.18.0
Add comment 2526 /// Generate Next Record Name
Add comment 2527 /// 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.
Add comment 2562 }
Add comment 2563
Add comment 2564 /// <summary>
Add comment 2565 Minus /// API Version 1.0.0
Add comment 2565 Plus /// API Version 1.0.0+
Add comment 2566 /// Export Records
Add comment 2567 /// This method allows you to export a set of records for a project.
Add comment 2568 /// 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.
Add comment 2658
Add comment 2659 }
Add comment 2660
Add comment 2661 Minus
Add comment 2662 2661 /// <summary>
Add comment 2663 Minus /// API Version 1.0.0
Add comment 2662 Plus /// API Version 1.0.0+
Add comment 2664 2663 /// Export Records
Add comment 2665 2664 /// This method allows you to export a set of records for a project.
Add comment 2666 2665 /// 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.
Add comment 2758 2757 }
Add comment 2759 2758
Add comment 2760 2759 /// <summary>
Add comment 2761 Minus /// API Version 1.0.0
Add comment 2760 Plus /// API Version 1.0.0++
Add comment 2761 Plus /// Export Record
Add comment 2762 Plus /// This method allows you to export a single record for a project.
Add comment 2763 Plus /// 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.
Add comment 2764 Plus /// </summary>
Add comment 2765 Plus /// <remarks>
Add comment 2766 Plus /// To use this method, you must have API Export privileges in the project.
Add comment 2767 Plus /// </remarks>
Add comment 2768 Plus /// <param name="token">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.</param>
Add comment 2769 Plus /// <param name="content">record</param>
Add comment 2770 Plus /// <param name="format">csv, json [default], xml, odm ('odm' refers to CDISC ODM XML format, specifically ODM version 1.3.1)</param>
Add comment 2771 Plus /// <param name="redcapDataType">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</param>
Add comment 2772 Plus /// <param name="record">a single record specifying specific records you wish to pull (by default, all records are pulled)</param>
Add comment 2773 Plus /// <param name="fields">an array of field names specifying specific fields you wish to pull (by default, all fields are pulled)</param>
Add comment 2774 Plus /// <param name="forms">an array of form names you wish to pull records for. If the form name has a space in it, replace the space with an underscore (by default, all records are pulled)</param>
Add comment 2775 Plus /// <param name="events">an array of unique event names that you wish to pull records for - only for longitudinal projects</param>
Add comment 2776 Plus /// <param name="rawOrLabel">raw [default], label - export the raw coded values or labels for the options of multiple choice fields</param>
Add comment 2777 Plus /// <param name="rawOrLabelHeaders">raw [default], label - (for 'csv' format 'flat' type only) for the CSV headers, export the variable/field names (raw) or the field labels (label)</param>
Add comment 2778 Plus /// <param name="exportCheckboxLabel">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.)</param>
Add comment 2779 Plus /// <param name="onErrorFormat">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'.</param>
Add comment 2780 Plus /// <param name="exportSurveyFields">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.</param>
Add comment 2781 Plus /// <param name="exportDataAccessGroups">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.</param>
Add comment 2782 Plus /// <param name="filterLogic">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. </param>
Add comment 2783 Plus /// <returns>Data from the project in the format and type specified ordered by the record (primary key of project) and then by event id</returns>
Add comment 2784 Plus public async Task<string> 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)
Add comment 2785 Plus {
Add comment 2786 Plus try
Add comment 2787 Plus {
Add comment 2788 Plus this.CheckToken(token);
Add comment 2789 Plus
Add comment 2790 Plus var payload = new Dictionary<string, string>
Add comment 2791 Plus {
Add comment 2792 Plus { "token", token },
Add comment 2793 Plus { "records", record },
Add comment 2794 Plus { "content", content.GetDisplayName() },
Add comment 2795 Plus { "format", format.GetDisplayName() },
Add comment 2796 Plus { "returnFormat", onErrorFormat.GetDisplayName() },
Add comment 2797 Plus { "type", redcapDataType.GetDisplayName() }
Add comment 2798 Plus };
Add comment 2799 Plus
Add comment 2800 Plus // Optional
Add comment 2801 Plus if (fields?.Length > 0)
Add comment 2802 Plus {
Add comment 2803 Plus payload.Add("fields", await this.ConvertArraytoString(fields));
Add comment 2804 Plus }
Add comment 2805 Plus if (forms?.Length > 0)
Add comment 2806 Plus {
Add comment 2807 Plus payload.Add("forms", await this.ConvertArraytoString(forms));
Add comment 2808 Plus }
Add comment 2809 Plus if (events?.Length > 0)
Add comment 2810 Plus {
Add comment 2811 Plus payload.Add("events", await this.ConvertArraytoString(events));
Add comment 2812 Plus }
Add comment 2813 Plus /*
Add comment 2814 Plus * Pertains to CSV data only
Add comment 2815 Plus */
Add comment 2816 Plus var _rawOrLabelValue = rawOrLabelHeaders.ToString();
Add comment 2817 Plus if (!IsNullOrEmpty(_rawOrLabelValue))
Add comment 2818 Plus {
Add comment 2819 Plus payload.Add("rawOrLabel", _rawOrLabelValue);
Add comment 2820 Plus }
Add comment 2821 Plus // Optional (defaults to false)
Add comment 2822 Plus if (exportCheckboxLabel)
Add comment 2823 Plus {
Add comment 2824 Plus payload.Add("exportCheckboxLabel", exportCheckboxLabel.ToString());
Add comment 2825 Plus }
Add comment 2826 Plus // Optional (defaults to false)
Add comment 2827 Plus if (exportSurveyFields)
Add comment 2828 Plus {
Add comment 2829 Plus payload.Add("exportSurveyFields", exportSurveyFields.ToString());
Add comment 2830 Plus }
Add comment 2831 Plus // Optional (defaults to false)
Add comment 2832 Plus if (exportDataAccessGroups)
Add comment 2833 Plus {
Add comment 2834 Plus payload.Add("exportDataAccessGroups", exportDataAccessGroups.ToString());
Add comment 2835 Plus }
Add comment 2836 Plus if (!IsNullOrEmpty(filterLogic))
Add comment 2837 Plus {
Add comment 2838 Plus payload.Add("filterLogic", filterLogic);
Add comment 2839 Plus }
Add comment 2840 Plus return await this.SendPostRequestAsync(payload, _uri);
Add comment 2841 Plus
Add comment 2842 Plus }
Add comment 2843 Plus catch (Exception Ex)
Add comment 2844 Plus {
Add comment 2845 Plus /*
Add comment 2846 Plus * We'll just log the error and return the error message.
Add comment 2847 Plus */
Add comment 2848 Plus Log.Error($"{Ex.Message}");
Add comment 2849 Plus return Ex.Message;
Add comment 2850 Plus }
Add comment 2851 Plus
Add comment 2852 Plus }
Add comment 2853 Plus
Add comment 2854 Plus
Add comment 2855 Plus /// <summary>
Add comment 2856 Plus /// API Version 1.0.0+
Add comment 2762 2857 /// Import Records
Add comment 2763 2858 /// This method allows you to import a set of records for a project
Add comment 2764 2859 /// </summary>