Bulk Download Automatic Course Archives
You can download several automatic course archives at once using the Automatic Archive Bulk Downloader script. With this script, you can select the specific courses you need or download the archives for all courses created in a specified date range. The script downloads the latest automatic archive of each course through the Learn REST API. It authenticates with a REST application that you set up once, so you don't need to use a Blackboard LMS username and password.
Download a single archive instead
If instead of downloading archives in bulk, you want to download a single archive, complete the following steps.
Go to the
/internal/autoArchivedirectory in the Content Collection.Open the subdirectory for the course you want. Each subdirectory is named with the course ID followed by the course creation date in YYYYMMDD format (for example, SampleCourseId01_20210125).
Select Download Package on the archive you want.
Before you begin
You need a computer with Python 3.8 or later, a Developer Portal account, and a Blackboard LMS user for the integration with a dedicated system role.
Create a system role for the integration user with only these privileges. Do not use the System Administrator role; the integration only needs to read automatic archives.
In the Administrator Panel, in the Users section, select System Roles.
Select Create Role.
Give the role a Name (for example, Auto Archive Integration), the select Submit.
Open the menu of the new role and select Manage Privileges.
Use Search to find each privilege below by the name shown in Blackboard LMS, select it, and select Permit Privileges.
In the Administrator Panel, in the Users section, select Users.
Search for the user you are using for this integration.
Edit the integration user and add the new role you created to its System Roles.
Privilege as shown in Blackboard LMS | Privilege ID | Why it is needed |
|---|---|---|
Read-only access to the Content System filesystem | | Read Content Collection resources through the REST API |
Course/Organization Control Panel (Packages and Utilities) > Archive Course/Organization | | Access the |
Course/Organization Control Panel (Packages and Utilities) > Archive Course/Organization, including user passwords | | Access the archive packages, which include course users' passwords. Without it the folders appear empty |
The privileges must be granted through system role. Granting them through a course role does not give access to /internal.
Register a REST application
You do this once in the Developer Portal; it give you the application ID, key, and secret.
Go to the Developer Portal and sign up for a developer account, or sign in if you already have one. Refer to First steps with the Learn REST API for more information.
Register a new REST Application, named, for example, Auto Archive Downloader - <your institution>.
Copy the Application ID, Application Key, and Application Secret.
Store the Application Secret in a password manager; the portal shows it only once.
Enable the application in Blackboard LMS
Once you have registered your application, you must enable it.
In the Administrator Panel, in the Integrations section, select REST API Integrations.
Select Create Integration.
In Application ID, paste the Application ID you got from the Developer Portal.
Next to Learn User, select Browse. Choose the integration user you set up in the Before you begin section that has the custom system role described.
Set End User Access to No, so the application always acts with that user's privileges.
Set Authorized to Act as User to No.
Select Submit.
Refer to REST API 통합 for details.
Install Python and the dependencies
The script needs Python 3.8 or later and two packages, requests and boto3. If you don't have Python 3, download and install it. Open a Terminal (macOS or Linux) or PowerShell (Windows) for the commands below.
Install pip. Python installers for Windows include pip. On macOS or Linux, check whether you have it:
python3 -m pip --versionIf you don't, install or upgrade it:
python3 -m pip install --user --upgrade pipCreate a virtual environment, so the packages stay separate from the rest of your system:
python3 -m venv env source env/bin/activate
On Windows, activate it with
env\Scripts\activateinstead.Install the dependencies:
python3 -m pip install requests boto3boto3is only used when the output is an S3 bucket.
Download the script
Download auto_archive_bulk_download_v2.py. Note where you save it; you will run it from that folder.
Run the script
The script gets a token with your application key and secret, lists /internal/autoArchive, and downloads the latest archive of each course you select, with its log file. When it finishes, it prints a summary.
Set the secret as an environment variable so it does not end up in your shell history. If you don't set it, the script asks for it.
export AUTO_ARCHIVE_SECRET='<application secret>'
On Windows, use $env:AUTO_ARCHIVE_SECRET = '<application secret>'.
Parameter | Required | Description |
|---|---|---|
| Yes | Base URL of Blackboard LMS site, for example, |
| Yes | Application key from Developer Portal |
| Yes | Where to save the archives: a local folder (for example |
| if no date range | Path to a text file with one course ID per line and no other delimiter. Course IDs are matched regardless of case |
| if no | Download archives of courses created in this range, in YYYY/MM/DD format. Use both together. With |
| No | Print every request the script makes. Tokens, secrets and signed URLs are never printed |
| No | Timeouts in seconds; the defaults are 30 and 300 |
Example with a course list:
python3 auto_archive_bulk_download.py --site https://mysite.blackboard.com -- key <application key> --output ~/Downloads/autoArchives --file ~/Documents/feedFile.txt
Example with a date range:
python3 auto_archive_bulk_download.py --site https://mysite.blackboard.com -- key <application key> --output ~/Downloads/autoArchives --beginDate 2020/01/20 --endDate 2021/01/20
Run only one instance of the script at a time to avoid performance degradation.
Output and summary
For each course the script saves the latest automatic archive ( .zip ) and its log ( .txt ) with their original names. Files are written to a temporary name and renamed when complete, so an interrupted run never leaves a partial archive. One course failing does not stop the others.
The summary lists:
How many archives were downloaded.
Courses with errors, with the reason.
Courses with an empty folder. This usually means the integration user is missing
course.archive.user.password.EXECUTE.Courses with a folder but no automatic archive package, with the files found in the folder. Only automatic archives are downloaded; other packages in the folder are skipped.
Archives downloaded without their log file.
Courses in
--filethat were not found, and courses found but outside the date range.Whether the run stopped early, and how many courses were not processed.
Exit Code | Meaning |
|---|---|
0 | Every selected course was processed without errors |
1 | Some courses had errors, or the run stopped early |
2 | The run could not start: invalid key or secret, missing privileges, or the output folder or course file cannot be used |
Use the exit code to detect failures when you schedule the script.
Limits
A new REST application can make 10,000 REST API calls every 24 hours (refer to limits). The script uses about one call per course, plus a few to find the folders, so a full run covers up to roughly 9,900 courses a day. If the limit is reached, the script stops, reports how many courses were not processed, and exits with code 1. Run it again the next day, or open a support ticket to raise the limit. In the ticket, include the email used to register the application and its production group name. Automatic archives are kept for 30 days. Schedule runs so that every archive you need is downloaded before it expires.
Troubleshooting
Message | What to check |
|---|---|
Could not get a token: the application key or secret is not valid | The key and |
The /internal/autoArchive folder is not visible to the integration user | The integration user's system role has |
Courses with an empty folder | The integration user's system role has |
Courses with a folder but no automatic archive package | The files listed next to the course are not automatic archives (for example, |
Too many requests (HTTP 429) | Another instance of the script, or another integration using the same application, is running; or the daily limit was reached |
Download failed with HTTP 401, 403 or 404 | The archive was deleted or expired between the listing and the download; run the script again for that course |
There are no automatic archives on this site | Automatic archiving is enabled and courses had activity in the last 30 days |