SIS Import API error

tadm9280
Community Novice

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!

Ruiling

$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_RETURNTRANSFER => 1,

        CURLOPT_POST => 1,

        CURLOPT_POSTFIELDS => $postdata

    ));

0 Likes