Skip to content

Events Import

asaweero edited this page Aug 22, 2017 · 4 revisions

Imports events into a project or change the attributes of currently existing events. Returns the number of events imported.

Required Parameters

  • override: If set to 1, all existing events are erased and any new events in data will be imported. By default, this is set to 0, which only allows adding events and renaming existing ones.
  • data: The events you wish to import/update. Events must contain two attributes. event_name and arm_num. If you're updating an event that is already in the project, you must also provide the unique_event_name attribute. If the project uses the scheduling module, then you can optionally provide the day_offset, offset_min, and offset_max attributes. If day_offset is not provided, then the events will be auto-numbered in the order in which they are provided in the API request.

Return Value

  • Return the Number of Events imported

Method Usage

      var params = {
         data: [
           {
             event_name: "import_test_event",
             arm_num: "1",
             unique_event_name: "import_test_event_arm_1"
           }
         ],
         override: 0
      };

      redcap.events.import (params, function (error, res) {
         // error containts oprtional errors
         if (err) {
            // handle error
         }
         else {
             // res is return value
             console.log (res);
         }
      });