public function exportRecords(
        $format = 'php',
        $type = 'flat',
        $recordIds = null,
        $fields = null,
        $forms = null,
        $events = null,
        $filterLogic = null,
        $rawOrLabel = 'raw',
        $rawOrLabelHeaders = 'raw',
        $exportCheckboxLabel = false,
        $exportSurveyFields = false,
        $exportDataAccessGroups = false
    ) {
        $data = array(
                'token'        => $this->apiToken,
                'content'      => 'record',
                'returnFormat' => 'json'
        );
        
        #---------------------------------------
        # Process the arguments
        #---------------------------------------
        $legalFormats = array('php', 'csv', 'json', 'xml', 'odm');
        $data['format'] = $this->processFormatArgument($format, $legalFormats);
        
        $data['type']    = $this->processTypeArgument($type);
        $data['records'] = $this->processRecordIdsArgument($recordIds);
        $data['fields']  = $this->processFieldsArgument($fields);
        $data['forms']   = $this->processFormsArgument($forms);
        $data['events']  = $this->processEventsArgument($events);
        
        $data['rawOrLabel']             = $this->processRawOrLabelArgument($rawOrLabel);
        $data['rawOrLabelHeaders']      = $this->processRawOrLabelHeadersArgument($rawOrLabelHeaders);
        $data['exportCheckboxLabel']    = $this->processExportCheckboxLabelArgument($exportCheckboxLabel);
        $data['exportSurveyFields']     = $this->processExportSurveyFieldsArgument($exportSurveyFields);
        $data['exportDataAccessGroups'] = $this->processExportDataAccessGroupsArgument($exportDataAccessGroups);
        
        $data['filterLogic'] = $this->processFilterLogicArgument($filterLogic);
        
        #---------------------------------------
        # Get the records and process them
        #---------------------------------------
        $records = $this->connection->callWithArray($data);
        $records = $this->processExportResult($records, $format);
      
        return $records;
    }
public function exportRecords(
        $format = 'php',
        $type = 'flat',
        $recordIds = null,
        $fields = null,
        $forms = null,
        $events = null,
        $filterLogic = null,
        $rawOrLabel = 'raw',
        $rawOrLabelHeaders = 'raw',
        $exportCheckboxLabel = false,
        $exportSurveyFields = false,
        $exportDataAccessGroups = false
    ) {
        $data = array(
                'token'        => $this->apiToken,
                'content'      => 'record',
                'returnFormat' => 'json'
        );
        
        #---------------------------------------
        # Process the arguments
        #---------------------------------------
        $legalFormats = array('php', 'csv', 'json', 'xml', 'odm');
        $data['format'] = $this->processFormatArgument($format, $legalFormats);
        
        $data['type']    = $this->processTypeArgument($type);
        $data['records'] = $this->processRecordIdsArgument($recordIds);
        $data['fields']  = $this->processFieldsArgument($fields);
        $data['forms']   = $this->processFormsArgument($forms);
        $data['events']  = $this->processEventsArgument($events);
        
        $data['rawOrLabel']             = $this->processRawOrLabelArgument($rawOrLabel);
        $data['rawOrLabelHeaders']      = $this->processRawOrLabelHeadersArgument($rawOrLabelHeaders);
        $data['exportCheckboxLabel']    = $this->processExportCheckboxLabelArgument($exportCheckboxLabel);
        $data['exportSurveyFields']     = $this->processExportSurveyFieldsArgument($exportSurveyFields);
        $data['exportDataAccessGroups'] = $this->processExportDataAccessGroupsArgument($exportDataAccessGroups);
        
        $data['filterLogic'] = $this->processFilterLogicArgument($filterLogic);
        
        #---------------------------------------
        # Get the records and process them
        #---------------------------------------
        $records = $this->connection->callWithArray($data);
        $records = $this->processExportResult($records, $format);
      
        return $records;
    }
public function exportRecords ( $ format = 'php' , $ type = 'flat' , $ recordIds = null , $ fields = null , $ forms = null , $ events = null , $ filterLogic = null , $ rawOrLabel = 'raw' , $ rawOrLabelHeaders = 'raw' , $ exportCheckboxLabel = false , $ exportSurveyFields = false , $ exportDataAccessGroups = false ) { $ data = array ( 'token' => $ this -> apiToken , 'content' => 'record' , 'returnFormat' => 'json' ) ; #--------------------------------------- # Process the arguments #--------------------------------------- $ legalFormats = array ( 'php' , 'csv' , 'json' , 'xml' , 'odm' ) ; $ data [ 'format' ] = $ this -> processFormatArgument ( $ format , $ legalFormats ) ; $ data [ 'type' ] = $ this -> processTypeArgument ( $ type ) ; $ data [ 'records' ] = $ this -> processRecordIdsArgument ( $ recordIds ) ; $ data [ 'fields' ] = $ this -> processFieldsArgument ( $ fields ) ; $ data [ 'forms' ] = $ this -> processFormsArgument ( $ forms ) ; $ data [ 'events' ] = $ this -> processEventsArgument ( $ events ) ; $ data [ 'rawOrLabel' ] = $ this -> processRawOrLabelArgument ( $ rawOrLabel ) ; $ data [ 'rawOrLabelHeaders' ] = $ this -> processRawOrLabelHeadersArgument ( $ rawOrLabelHeaders ) ; $ data [ 'exportCheckboxLabel' ] = $ this -> processExportCheckboxLabelArgument ( $ exportCheckboxLabel ) ; $ data [ 'exportSurveyFields' ] = $ this -> processExportSurveyFieldsArgument ( $ exportSurveyFields ) ; $ data [ 'exportDataAccessGroups' ] = $ this -> processExportDataAccessGroupsArgument ( $ exportDataAccessGroups ) ; $ data [ 'filterLogic' ] = $ this -> processFilterLogicArgument ( $ filterLogic ) ; #--------------------------------------- # Get the records and process them #--------------------------------------- $ records = $ this -> connection -> callWithArray ( $ data ) ; $ records = $ this -> processExportResult ( $ records , $ format ) ; return $ records ; }
Exports the specified records.

Example usage:
<code>
$records = $project->exportRecords($format = 'csv', $type = 'flat');
$recordIds = [1001, 1002, 1003];
$records = $project->exportRecords('xml', 'eav', $recordIds);
</code>

@param string $format the format in which to export the records:
<ul>
<li> 'php' - [default] array of maps of values</li>
<li> 'csv' - string of CSV (comma-separated values)</li>
<li> 'json' - string of JSON encoded values</li>
<li> 'xml' - string of XML encoded data</li>
<li> 'odm' - string with CDISC ODM XML format, specifically ODM version 1.3.1</li>
</ul>
@param string $type the type of records exported:
<ul>
<li>'flat' - [default] exports one record per row.</li>
<li>'eav'  - exports one data point per row:, so,
for non-longitudinal studies, each record will have the following
fields: record_id, field_name, value. For longitudinal studies, each record
will have the fields: record_id, field_name, value, redcap_event_name.
</li>
</ul>
@param array $recordIds array of strings with record id's that are to be retrieved.
@param array $fields array of field names to export
@param array $forms array of form names for which fields should be exported
@param array $events array of event names for which fields should be exported
@param array $filterLogic logic used to restrict the records retrieved, e.g.,
"[last_name] = 'Smith'".
@param string $rawOrLabel indicates what should be exported for options of multiple choice fields:
<ul>
<li> 'raw' - [default] export the raw coded values</li>
<li> 'label' - export the labels</li>
</ul>
@param string $rawOrLabelHeaders when exporting with 'csv' format 'flat' type, indicates what format
should be used for the CSV headers:
<ul>
<li> 'raw' - [default] export the variable/field names</li>
<li> 'label' - export the field labels</li>
</ul>
@param boolean $exportCheckboxLabel specifies the format for checkbox fields for the case where
$format = 'csv', $rawOrLabel = true, and $type = 'flat'. For other cases this
parameter is effectively ignored.
<ul>
<li> true - checked checkboxes will have a value equal to the checkbox option's label
(e.g., 'Choice 1'), and unchecked checkboxes will have a blank value.
</li>
<li> false - [default] checked checkboxes will have a value of 'Checked', and
unchecked checkboxes will have a value of 'Unchecked'.
</li>
</ul>
@param boolean $exportSurveyFields specifies whether survey fields should be exported.
<ul>
<li> true - export the following survey fields:
<ul>
<li> survey identifier field ('redcap_survey_identifier') </li>
<li> survey timestamp fields (instrument+'_timestamp') </li>
</ul>
</li>
<li> false - [default] survey fields are not exported.</li>
</ul>
@param boolean $exportDataAccessGroups specifies whether the data access group field
('redcap_data_access_group') should be exported.
<ul>
<li> true - export the data access group field if there is at least one data access group, and
the user calling the method (as identified by the API token) is not
in a data access group.</li>
<li> false - [default] don't export the data access group field.</li>
</ul>

@return mixed If 'php' format is specified, an array of records will be returned where the format
of the records depends on the 'type'parameter (see above). For other
formats, a string is returned that contains the records in the specified format.
Exports the specified records .