Working …
This value you provided is not a number. Please try again.
This value you provided is not an integer. Please try again.
The value entered is not a valid Vanderbilt Medical Record Number (i.e. 4- to 9-digit number, excluding leading zeros). Please try again.
The value you provided must be within the suggested range
The value you provided is outside the suggested range
This value is admissible, but you may wish to double check it.
The value entered must be a time value in the following format HH:MM within the range 00:00-23:59 (e.g., 04:32 or 23:19).
This field must be a 5 or 9 digit U.S. ZIP Code (like 94043). Please re-enter it now.
This field must be a 10 digit U.S. phone number (like 415 555 1212). Please re-enter it now.
This field must be a valid email address (like joe@user.com). Please re-enter it now.
The value you provided could not be validated because it does not follow the expected format. Please try again.
Required format:

General API Info

Supported Methods

Arms
Data Access Groups
Events
Field Names
Files
File Repository
Instruments
Logging
Metadata
Projects
Records
Repeating Instruments and Events
Reports
REDCap
Surveys
Users & User Privileges
User Roles
REDCap API Documentation
Method Name

Import Records

Description

This method allows you to import a set of records for a project

URL
https://chi-redcap.dshs.texas.gov/redcap/api/
Supported Request Method
POST
Permissions Required
To use this method, you must have API Import/Update privileges in the project.
Parameters (case sensitive)
Required
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.
content
record
format
csv, json, xml [default], odm ('odm' refers to CDISC ODM XML format, specifically ODM version 1.3.1)
type
  • 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
* 'record' refers to the record ID for the project
** Event name is the unique name for an event, not the event label
overwriteBehavior
  • normal - blank/empty values will be ignored [default]
  • overwrite - blank/empty values are valid and will overwrite data
forceAutoNumber
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.
backgroundProcess
Specifies whether to do the import as background process.
  • 0 or 'false' for no. [default]
  • 1 or 'true' for yes.
data
The formatted data to be imported.

TIP: If importing repeating instances for a repeating event or repeating instrument, you may auto-number the instances by providing a value of 'new' for the 'redcap_repeat_instance' field in the dataset you are importing. This is useful because it allows you to import such data without the need to determine how many instances already exist for a given repeating event/instance prior to the import. NOTICE: The 'new' value option for auto-numbering instances does NOT work for 'eav' type data but only for 'flat' type.

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'.

EAV XML:

<?xml version="1.0" encoding="UTF-8" ?>
<records>
   <item>
      <record></record>
      <field_name></field_name>
      <value></value>
      <redcap_event_name></redcap_event_name>
   </item>
</records>

Flat XML:

<?xml version="1.0" encoding="UTF-8" ?>
<records>
   <item>
      each data point as an element
      ...
   </item>
</records>
Optional
dateFormat
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.
csvDelimiter
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.
returnContent
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).
NOTE: Does not apply when importing as a background process (i.e., backgroundProcess=true). When using a background process, success:true (upon success) or success:false (upon failure) will be returned in the appropriate format (csv, json, xml).
returnFormat
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'.
NOTE: Does not apply when importing as a background process (i.e., backgroundProcess=true). When using a background process, success:true (upon success) or success:false (upon failure) will be returned in the appropriate format (csv, json, xml).
Returns

the content specified by returnContent

REDCap Software - Version 14.9.1 - © 2024 Vanderbilt University