Back

FAQ

Do you have code samples for implementing the API?

These code samples will help you set up your system to download and process data files using the web service.

JavaScript

Attached is a .zip file containing sample JavaScript code to download score reporting files and retrieve a list of data for files posted for your organization: pascoredwnld-javascript-sample.zip.

To run the sample JavaScript client (download.js):

  1. Download and install node.js version 4.4.2 (or later)
  2. Test node.js installation -- run 'node --version', it should display 'v4.4.2'
  3. Open download.js, check configurations and make proper modifications in initConfig:
var initConfig = {
scoredwnldHost: 'scoresdownload.collegeboard.org',
scoredwnldPort: '443',
localFilePath: 'C:/TEMP/',
username:'exampleuser',
password:'examplepass'
};
  1. Run the script: 'node download.js', this would provide how to use the script file.
  2. Run the script: 'node download.js list', to get the list of files.
  3. Run the script: 'node download.js download <filename>' to download the file.

Java

Attached is a .zip file containing the sample Java project to download score reporting files and retrieve a list of data for files posted for your organization: pascoredwnld-java-sample.zip.To build the project, gradle is needed. Gradle can be obtained from gradle.org

To build and run the sample:

  1. Unzip the files.
  2. The config.properties file can be updated with the login credentials and file download path.
  3. Build the project by 'gradle clean install'
  4. Go to ./build/libs folder
  5. Run the code below to get information on how to use the Example:
'java -classpath pascoredwnld-client.jar;"lib/*" org.collegeboard.scoredwnld.client.Example
  1. To obtain the list of downloadable files, run the following:
'java -classpath pascoredwnld-client.jar;"lib/*" org.collegeboard.scoredwnld.client.Example list
  1. To download a specific file, run the following with the filename at the end replacing <filename>
'java -classpath ../..;pascoredwnld-client.jar;"lib/*" org.collegeboard.scoredwnld.client.Example download <filename>

Note: "../.." in the classpath, would allow the config.properties file to be read. The file can be located anywhere but referring to it appropriately in the classpath would allow the code to read the contents from it and override the default that is hardcoded.

cURL

Attached is a .zip file containing the sample cURL scripts to call the different service endpoints using cURL: pascoredwnld-curl-sample.zip.

To run the sample cURL scripts:

  1. The .zip files contain login.sh, list.sh, and fileurl.sh files.
  2. Extract the zip file content.
  3. In each of these files, change the values for the username and password.
  4. Run the login.sh script, this should provide the login token as response.
  5. Run the list.sh script, this should provide the list of files as response.
  6. In the fileurl.sh, change the filename to a filename that is available in the previous response and run the fileurl.sh. This should provide the fileUrl as response. The fileUrl can be used to download the file.

Resources