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:
- 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.
- 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>" https://td-setup.appspot.com/<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.
- passkey: A pass key used to authenticate against the domain for which the CSV file is uploaded. This pass key can be found at https://settings.teacherdashboard.com/#/d/studentdomain/loader/url-load. If the pass key is not correct, then the uploaded CSV file will not be processed.
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 = 'https://td-setup.appspot.com/
$post = array(
'passkey' => '<PASS KEY>',
'uploadFile' => '@<PATH_TO_YOUR_CSV_FILE>');
$ch = curl_init();
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
If your CSV is larger than 5MB, then we recommend building your URL request in this format:
curl -F "passkey=<PASS_KEY>" https://td-setup.appspot.com/<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>" https://td-setup.appspot.com/<DOMAIN_NAME>/createuploadurl > tmpFile
set /p myvar= < tmpFile
curl -X POST --header "Transfer-Encoding: chunked" -F "file=@<PATH_TO_YOUR_CSV_FILE>" %myvar%