Automating Data Loads with cURL Follow

To automate data loading, Teacher Dashboard lets schools upload CSV files of Class and Student data through standard HTTP requests.

Doing so involves uploading a CSV file through a URL request tool (such as cURL). To run this process, you must complete the following steps:

  1. Perform an automated export of data from your Student Information System to a CSV file in a local directory. This CSV file should contain the same fields required if you were uploading data for Teacher Dashboard through a Google Spreadsheet.
  2. Create a CRON job (Unix) or Scheduled Task (Windows) containing the URL request specified below.

Once you have set up the above two steps, you can use cURL or another URL request tool to upload the CSV file to Teacher Dashboard. Here is how to use cURL to upload CSV files to Teacher Dashboard:

curl -F "passkey=<PASS_KEY>" -F "uploadFile=@<PATH_TO_YOUR_CSV_FILE>"<DOMAIN_NAME>/csvupload

The mandatory parameters of this request are:

  • uploadFile: The CSV file object to be uploaded. The location of the file must be prefixed with @. This instructs cURL to construct an HTTP Request containing the file.

The optional parameters of this request are:

  • loadAll: If this parameter is set to "True" (or any non-empty value), then the load will process all records specified in the CSV file. If it is not specified, the load will only process records which it detects have changed from the previous load.
  • multipleYears: If this parameter is set to "Y", then the load will process all classes specified in the CSV file regardless of year. If it is not specified, then the load will only process classes that are in the same year as existing classes.

For those using PHP, a suggested format of the PHP command is below:

$target_url = '<DOMAIN_NAME>/csvupload';
$post = array(
   'passkey' => '<PASS KEY>',
   'uploadFile' => '@<PATH_TO_YOUR_CSV_FILE>');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$target_url);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$result=curl_exec ($ch);
curl_close ($ch); 


If your CSV is larger than 5MB, then we recommend building your URL request in this format:

Linux/MacOS users:

curl -F "passkey=<PASS_KEY>"<DOMAIN_NAME>/createuploadurl | xargs curl -X POST --header "Transfer-Encoding: chunked" -F "file=@<PATH_TO_YOUR_CSV_FILE>"

Windows users can create a batch file to run the following:
Note: tmpFile is a path you're setting for a temporary file to be created by this process.

curl -F "passkey=<PASS_KEY>"<DOMAIN_NAME>/createuploadurl > tmpFile
set /p myvar= < tmpFile
curl -X POST --header "Transfer-Encoding: chunked" -F "file=@<PATH_TO_YOUR_CSV_FILE>" %myvar%
del tmpFile
Additional Resources:
Have more questions? Submit a request