AnsweredAssumed Answered

SIS Import API error

Question asked by R Zhang on Sep 4, 2019

I am trying to call SISimport API with the attachment csv file, there's error indicating "Couldn't find Canvas CSV import headers", and also noted in SIS importing log that "downloadable_attachment_ids" did not get any file information.  While I attached the same csv file, directly call sisimport using cUrl command line, it works fine.  So, is something I missed during passing the file params?    Thanks in advance!




$testcsv= 'enrollments.csv';

$file_name_with_path =realpath('./'$testcsv);

$postdata = array(

    'name'=> $testcsv,

    'file' => '@'.$file_name_with_path);


$testheaders = array(

'Content-Type: text/csv');

    $ch = curl_init();

    curl_setopt_array($ch, array(

        CURLOPT_URL => $myUrl.'accounts/'.$AccountId.'/sis_imports.json?import_type=instructure_csv&extension=csv&access_token='.$apiToken,

         CURLOPT_HTTPHEADER =>array('Content-Type:text/csv'),


        CURLOPT_POST => 1,

        CURLOPT_POSTFIELDS => $postdata