Getting Started
A step-by-step guide for IT admins, analysts, and non-technical users.
1. Get API Client ID and Secret
To access the DAP API, you will need a Client ID and Secret. These are generated via the Instructure Identity Services.
Steps:
Log into Instructure Identity Services.
Select your institution from the drop-down menu and log in.
Once authorized, navigate to the dashboard and click Add New Key.
Enter a name for the key and set the expiration time.
Copy the Client ID and Secret when they appear. Note: These are displayed only once. If you lose them, you will need to generate new ones.
2. Install DAP CLI on Your Computer
The DAP CLI tool allows you to interact with the Canvas Data 2 API. Installation steps differ slightly depending on your operating system.
For Mac:
Install Xcode Developer Tools:
download and install Python 3.10+ from here:
Install PIP (if not installed by default):
Install the DAP CLI tool with PostgreSQL support:
For Windows:
Install Python 3.10+ from here.
Install the DAP CLI tool using the Windows command prompt:
If you miss installing an extra feature, the library will not be able to synchronize data with a database, and you may get an error message similar to the following:
3. Store Client Credentials in Environment Variables
For secure access to the API, it's recommended to store your credentials as environment variables. This prevents sensitive information from being exposed in command-line arguments.
MacOS/Linux:
Open Terminal and run the following commands, replacing placeholders with your actual Client ID and Secret:
Restart Terminal for changes to take effect.
Windows:
Follow this guide to setting environment variables or use the set
command in the Windows command line:
4. Work with Databases
DAP CLI allows you to interact with PostgreSQL or MySQL databases. You will need the connection string of your database for DAP to function correctly.
Connection String Format:
Example for PostgreSQL:
Store Connection String in Environment Variables
MacOS/Linux:
Open Terminal and run the following commands, replacing placeholders with your actual Client ID and Secret:
Restart Terminal for changes to take effect.
Windows:
Follow this guide to setting environment variables or use the set
command in the Windows command line:
Obtain a Full Snapshot of a Table
Use the dap initdb
command to download a full snapshot of a table and store it in your database.
Command:
Regular use of snapshots is not recommended, as they are resource-intensive for the API and costly to process on the client side.
Synchronize Data with a Table
After obtaining a snapshot, keep your database updated with the dap syncdb
command. This ensures incremental changes are applied to your table.
Command:
Changing the Temporary Storage Location
If you need to change the temporary storage directory for data processing, you can configure the location using the following command-line option:
5. Export Data
You can export data using either the snapshot or incremental methods, depending on your use case.
Snapshot Export
Use dap snapshot
command to download a full copy of a table at a point in time.
Command:
Regular use of snapshots is not recommended, as they are resource-intensive for the API and costly to process on the client side.
Incremental Export
The dap incremental
commands captures only the data that has changed since your last export.
Command:
Related Resources
Last updated