Back
Code Samples for AP Higher Education Score Report Web Service
Get code samples that will assist in downloading AP score report data files using the web service.
These code samples will help you set up your system to generate and download AP score report data files using the web service.
JavaScript
Attached is a .zip file containing sample JavaScript code to generate and download AP score data files for your organization: aposrd-node-sample.zip.
To Run the Sample JavaScript Client (NodeExample.cjs)
- Download the ZIP file linked above, extract it, and navigate to the directory in your terminal or command line.
- Download and install node.js version 20.10.2 (or later).
- Test node.js installation -- execute ‘'node --version',’ it should display “'v20.10.0.”'
- Open NodeExample.cjs and update the configuration:
const parameters = {
username: 'u', // enter username credential, this will be your account email
password: 'p', // enter password credential
diCode: '0000', // di code that the user account has access to
format: "TXT', // TXT or CSV
downloadType: 'full', // full or new
};
const DOWNLOAD_LOCATION = '/Users/your_username/Downloads/'; // update this to your local download location, ex. C:/TEMP/ or /Users/your_username/Downloads/ - Run the script with 'node NodeExample.cjs' to generate and download a file based on the parameters entered in step 3 above.
- Updates will be logged such as 'Step 1/4 complete: Authentication successful.' as the script progresses. If any step is unsuccessful, you will see a message or error logged.
Java
Attached is a .zip file containing the sample Java project to generate and download score report data files for your organization: aposrd-java-example.zip.
To Run the Sample Java Cient
- Download the ZIP file linked above, extract it, and navigate to the directory in your terminal or command line.
- To build the project, gradle is needed. Gradle can be obtained from Gradle Build Tool
- Test gradle installation -- execute 'gradle --version', it should display the version information 'Gradle 8.14.3'
- Open the ./src/main/resources/config.properties file and update the configuration:
username=u
password=p
diCode=0000
format=TXT
downloadType=full
downloadLocation=${user.home}/Downloads/ - In command line, run the project with 'gradle run'
prompt> gradle run
Curl
Attached is a .zip file containing the sample curl script to generate and download score report data files for your organization: aposrd-curl-example.zip.
To Run the Sample Curl Script (curlExample.sh):
- Download the ZIP file linked above, extract it, and navigate to the directory in your terminal or command line.
- Ensure curl and jq are installed
- for curl - test by running 'curl --version' (Mac and Windows should come with this pre-installed)
- for jq - test by running 'jq --version', if not installed it may be found here: Download jq
- Open curlExample.sh, update the configuration:
DOWNLOAD_LOCATION="$HOME/Downloads"
USERNAME="u" # Replace with your username, this will be your account email
PASSWORD="p" # Replace with your password
DICODE="0000" # DI code
FORMAT="TXT" # File format ( TXT or, CSV)
DOWNLOAD_TYPE="full" # Download type (e.g., full, new) - Run the script with './curlExample.sh'
Note: the script must have execute permissions