### Install DAP CLI Dependencies Source: https://developerdocs.instructure.com/services/dap/dap-cli-readme/dap-cli-getting-started Install required system dependencies for the DAP CLI tool. For macOS, install Xcode Developer Tools, Python 3.10+, and pip. For Windows, install Python 3.10+. Then install the DAP CLI tool with PostgreSQL support using pip3. ```shell # For Mac: # Install Xcode Developer Tools xcode-select --install # Verify Python installation python3 --version # Verify pip installation pip3 --version # Install DAP CLI with PostgreSQL support pip3 install "instructure-dap-client[postgresql]" # For Windows: # Install Python 3.10+ from python.org downloads # Then install DAP CLI pip3 install "instructure-dap-client[postgresql]" # If missing asyncpg dependency, install pysqlsync pip install pysqlsync[postgresql] ``` -------------------------------- ### Download Full Table Snapshots with dap initdb Source: https://developerdocs.instructure.com/services/dap/dap-cli-readme/dap-cli-getting-started Uses dap initdb to retrieve complete snapshots of specified tables and load them into the configured database. ```sh dap initdb --connection-string postgresql://user:password@localhost/mydb --namespace canvas --table accounts,users ``` -------------------------------- ### Set Database Connection String (macOS/Linux) Source: https://developerdocs.instructure.com/services/dap/dap-cli-readme/dap-cli-getting-started Exports DAP_CONNECTION_STRING with a PostgreSQL URI for DAP CLI to connect to the target database. ```sh export DAP_CONNECTION_STRING=postgresql://user:password@localhost:5432/mydatabase ``` -------------------------------- ### Run DAP Command with Inline Credentials Source: https://developerdocs.instructure.com/services/dap/dap-cli-readme/dap-cli-getting-started Executes a DAP incremental sync providing client ID and secret directly on the command line. Use only when environment variables are not set. ```sh dap --client-id=us-east-1#0c59cade-...-2ac120002 --client-secret=xdEC0lI...4X4QBOhM incremental --namespace canvas --table accounts --since 2022-07-13T09:30:00+02:00 ``` -------------------------------- ### Synchronize Incremental Changes with dap syncdb Source: https://developerdocs.instructure.com/services/dap/dap-cli-readme/dap-cli-getting-started Runs dap syncdb to apply incremental updates to previously loaded tables, keeping the database in sync with Canvas Data. ```sh dap syncdb --connection-string postgresql://user:password@localhost/mydb --namespace canvas --table accounts,users ``` -------------------------------- ### Set API Client Credentials (Windows) Source: https://developerdocs.instructure.com/services/dap/dap-cli-readme/dap-cli-getting-started Sets DAP_CLIENT_ID and DAP_CLIENT_SECRET in the Windows command prompt using the set command. ```sh set DAP_CLIENT_ID=your_canvas_data_client_id set DAP_CLIENT_SECRET=your_canvas_data_secret ``` -------------------------------- ### Set Database Connection String (Windows) Source: https://developerdocs.instructure.com/services/dap/dap-cli-readme/dap-cli-getting-started Sets DAP_CONNECTION_STRING environment variable in Windows command prompt. ```sh set DAP_CONNECTION_STRING=postgresql://user:password@localhost:5432/mydatabase ``` -------------------------------- ### Initialize and synchronize a PostgreSQL database with DAP using Python Source: https://developerdocs.instructure.com/services/dap/lib-index/lib-examples This example demonstrates configuring a PostgreSQL connection, initializing the DAP schema, and synchronizing data using SQLReplicator. It requires the dap library, a running PostgreSQL instance, and appropriate credentials. The code creates a meta-table for sync metadata and runs a snapshot query to populate the tables. ```python from dap.api import DAPClient\nfrom dap.integration.database import DatabaseConnection, DatabaseConnectionConfig\nfrom dap.replicator.sql import SQLReplicator\nfrom dap.log import configure_logging\n\nconfigure_logging()\n\n# Define connection parameters as an object\nconnection_params = DatabaseConnectionConfig(\n dialect="postgresql",\n host="server.example.com",\n port=5432,\n username="scott",\n password="password",\n database="testdb"\n)\n\n# Initialize database connection with the object-based parameters\ndb_connection = DatabaseConnection(connection_params)\n\n# Use the DAPClient and SQLReplicator\nasync with DAPClient() as session:\n sql_replicator = SQLReplicator(session, db_connection)\n await sql_replicator.version_upgrade()\n await sql_replicator.initialize(namespace, table_name) ``` -------------------------------- ### Initialize and Sync Database Tables Source: https://developerdocs.instructure.com/services/dap/dap-cli-readme/dap-cli-getting-started Use DAP CLI commands to download and synchronize database tables. The initdb command obtains full snapshots of specified tables, while syncdb applies incremental changes. These commands require a connection string and support targeting specific namespaces and tables within the Canvas Data 2 API. ```shell # Download full snapshots of tables dap initdb --connection-string postgresql://user:password@localhost/mydb --namespace canvas --table accounts,users # Synchronize tables with incremental changes dap syncdb --connection-string postgresql://user:password@localhost/mydb --namespace canvas --table accounts,users ``` -------------------------------- ### GET /asset_collections/{guid} Source: https://developerdocs.instructure.com/services/ab-connect/reference/asset-collections Retrieve details of a specific Asset Collection using its GUID. The GUID can be obtained through listing or searching collections. ```APIDOC ## GET /asset_collections/{guid} ### Description Retrieve detailed information about a specific Asset Collection using its GUID. ### Method GET ### Endpoint /asset_collections/{guid} ### Parameters #### Path Parameters - **guid** (string) - Required - Unique identifier for the Asset Collection ### Response #### Success Response (200) - **guid** (string) - Unique identifier for the Asset Collection - **name** (string) - Name of the Asset Collection - **filters** (object) - Filter criteria - **advanced_search** (object) - Advanced search parameters #### Response Example { "guid": "abc123", "name": "Sample Collection", "filters": {}, "advanced_search": {} } ``` -------------------------------- ### Initialize DAPClient in Python Source: https://developerdocs.instructure.com/services/dap/lib-index/lib-examples Demonstrates how to instantiate the DAPClient class with credentials. The client can automatically extract credentials from environment variables. ```python import os from dap.api import DAPClient from dap.dap_types import Credentials from dap.log import configure_logging client_id: str = os.environ["DAP_CLIENT_ID"] client_secret: str = os.environ["DAP_CLIENT_SECRET"] credentials = Credentials.create(client_id=client_id, client_secret=client_secret) configure_logging() async with DAPClient(credentials=credentials) as session: ... ``` ```python async with DAPClient() as session: ... ``` -------------------------------- ### GET /providers/{guid} Source: https://developerdocs.instructure.com/services/ab-connect/reference/providers Retrieve details of a specific Provider identified by its GUID. Returns provider name, GUID, and licensed taxonomies. ```APIDOC ## GET /providers/{guid}\n\n### Description\nRetrieve details of a specific Provider identified by its GUID. Returns provider name, GUID, and licensed taxonomies.\n\n### Method\nGET\n\n### Endpoint\n/providers/{guid}\n\n### Parameters\n#### Path Parameters\n- **guid** (string) - Required - The unique GUID of the Provider.\n\n#### Query Parameters\n- *None*\n\n#### Request Body\n- *None*\n\n### Request Example\n```\nGET /providers/123e4567-e89b-12d3-a456-426614174000 HTTP/1.1\nHost: api.example.com\n```\n\n### Response\n#### Success Response (200)\n- **id** (string) - Provider GUID.\n- **name** (string) - Provider name.\n- **taxonomies** (array[string]) - List of AB taxonomies licensed.\n- **relationships** (object) - Owners and Consumers if applicable.\n\n### Response Example\n```\n{\n \"id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"name\": \"Acme Provider\",\n \"taxonomies\": [\"taxonomy1\", \"taxonomy2\"],\n \"relationships\": {\n \"owners\": [],\n \"consumers\": []\n }\n}\n``` ``` -------------------------------- ### JavaScript Configuration Example Source: https://developerdocs.instructure.com/services/ab-connect/introduction/widgets An example JavaScript configuration object demonstrating the use of uiEntityState to control initial UI values and visibility. It includes properties for authority, publication, and document selections, showcasing the use of 'show' and 'value' attributes. ```javascript uiEntityState: { authority: { show: false, value: "A83297F2-901A-11DF-A622-0C319DFF4B22" }, publication: { show: false, value: "964E0FEE-AD71-11DE-9BF2-C9169DFF4B22" }, document: { show: false, value: "6C2635F0-6EC0-11DF-AB2D-366B9DFF4B22" } } ``` -------------------------------- ### DELETE /assets/{guid} Source: https://developerdocs.instructure.com/services/ab-connect/reference/assets Deletes a specific Asset using its AB GUID or self URL. If only the client_id is known, search first to get the GUID. ```APIDOC ## DELETE /assets/{guid} ### Description Deletes the Asset identified by its AB GUID. ### Method DELETE ### Endpoint /assets/{guid} ### Parameters #### Path Parameters - **guid** (string) - Required - The AB GUID of the Asset. #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (204) No content returned on successful deletion. #### Response Example None ``` -------------------------------- ### GET /predictions/{guid}/topics Source: https://developerdocs.instructure.com/services/ab-connect/reference/relationships Fetches related topics for a given prediction GUID. Supports filtering and sorting on relationship properties. ```APIDOC ## GET /predictions/{guid}/topics ### Description Fetches related topics for a given prediction GUID. You can filter and sort on relationship properties like `meta.score` or on the item properties themselves. ### Method GET ### Endpoint /predictions/{guid}/topics ### Parameters #### Path Parameters - **guid** (string) - Required - The GUID of the prediction. #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **data** (array) - An array of related topic objects. - **id** (string) - The ID of the topic. - **type** (string) - The type of the topic. - **attributes** (object) - Attributes of the topic. - **name** (string) - The name of the topic. - **meta** (object) - Meta information about the topic. - **score** (number) - The score of the topic. #### Response Example { "data": [ { "id": "topic1", "type": "topic", "attributes": { "name": "Topic 1", "meta": { "score": 0.90 } } }, { "id": "topic2", "type": "topic", "attributes": { "name": "Topic 2", "meta": { "score": 0.75 } } } ] } ``` -------------------------------- ### Build Script for AB Connect Widget Source Source: https://developerdocs.instructure.com/services/ab-connect/introduction/examples Installs dependencies and builds the widget source using npm. Requires Node.js and npm installed in the unzipped source directory. Inputs: source files. Outputs: widgets.js and widgets.js.map in dist/. Limitations: Must be run in a directory with package.json. ```bash npm install npm run build ``` -------------------------------- ### GET /predictions/{guid}/standards Source: https://developerdocs.instructure.com/services/ab-connect/reference/relationships Fetches related standards for a given prediction GUID. Supports filtering and sorting on relationship properties. ```APIDOC ## GET /predictions/{guid}/standards ### Description Fetches related standards for a given prediction GUID. You can filter and sort on relationship properties like `meta.score` or on the item properties themselves. ### Method GET ### Endpoint /predictions/{guid}/standards ### Parameters #### Path Parameters - **guid** (string) - Required - The GUID of the prediction. #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **data** (array) - An array of related standard objects. - **id** (string) - The ID of the standard. - **type** (string) - The type of the standard. - **attributes** (object) - Attributes of the standard. - **name** (string) - The name of the standard. - **meta** (object) - Meta information about the standard. - **score** (number) - The score of the standard. #### Response Example { "data": [ { "id": "standard1", "type": "standard", "attributes": { "name": "Standard 1", "meta": { "score": 0.95 } } }, { "id": "standard2", "type": "standard", "attributes": { "name": "Standard 2", "meta": { "score": 0.85 } } } ] } ``` -------------------------------- ### Live Events Setup Source: https://developerdocs.instructure.com/services/canvas/data-services/live-events Details the setup process for the Live Events service. ```APIDOC ## Setup ### Description Details the setup process for the Live Events service. ### Endpoint N/A ### Method N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### Production Build Script for AB Connect Widget Source: https://developerdocs.instructure.com/services/ab-connect/introduction/examples Sets production environment and builds the widget source using npm. Requires Node.js and npm. Inputs: source folder. Outputs: optimized widgets.js in dist/. Limitations: Environment variable syntax differs by shell; Windows uses cmd.exe. ```bash NODE_ENV=production npm run build ``` ```cmd set NODE_ENV=production npm run build ``` -------------------------------- ### GET /concepts/{guid} Source: https://developerdocs.instructure.com/services/ab-connect/reference/concepts Retrieve the details of a specific Concept by its AB GUID. This endpoint provides metadata and context for a single Concept. ```APIDOC ## GET /concepts/{guid} ### Description Retrieve the details of a specific Concept by its AB GUID. This endpoint provides metadata and context for a single Concept. ### Method GET ### Endpoint /concepts/{guid} ### Parameters #### Path Parameters - **guid** (string) - Required - The AB GUID of the Concept to retrieve. ### Response #### Success Response (200) - **id** (string) - The AB GUID of the Concept. - **name** (string) - The name of the Concept. - **description** (string) - A description of the Concept. - **context** (string) - Additional context to clarify ambiguous terms. #### Response Example { "id": "123e4567-e89b-12d3-a456-426614174000", "name": "Algebraic Expressions", "description": "Understanding and manipulating algebraic expressions.", "context": "In the context of middle school mathematics." } ``` -------------------------------- ### GET /clarifier/{guid} Source: https://developerdocs.instructure.com/services/ab-connect/reference/relationships Retrieves clarifications for a specific Asset. Requires the Asset's GUID to be included as a path parameter. Access to the Clarifier is controlled by licensing. ```APIDOC ## GET /clarifier/{guid} ### Description Retrieves clarifications for an Asset identified by its GUID. ### Method GET ### Endpoint /clarifier/{guid} ### Parameters #### Path Parameters - **guid** (string) - Required - The GUID of the Asset for which to retrieve clarifications. #### Query Parameters None #### Request Body None ### Request Example { "guid": "asset_guid_value" } ### Response #### Success Response (200) - **clarifications** (array) - An array of clarification objects. #### Response Example { "clarifications": [ { "field1": "example_value" } ] } ``` -------------------------------- ### Bash Example: Pagination Link Header Source: https://developerdocs.instructure.com/get_started Example of a Link header in a response indicating pagination, commonly used in APIs like Canvas LMS to split large datasets into multiple pages. Follow these links to retrieve all data. ```bash Link: ; rel="next" ``` -------------------------------- ### GET /topics/{guid} Source: https://developerdocs.instructure.com/services/ab-connect/reference/topics Retrieve details of a specific Topic by its AB GUID. This endpoint returns comprehensive metadata about a single topic in the Academic Benchmarks taxonomy. ```APIDOC ## GET /topics/{guid} ### Description Retrieve details of a specific Topic by its AB GUID. This endpoint returns comprehensive metadata about a single topic in the Academic Benchmarks taxonomy. ### Method GET ### Endpoint /topics/{guid} ### Parameters #### Path Parameters - **guid** (string) - Required - The AB GUID of the Topic to retrieve ### Request Example ```http GET /topics/AB1234567890 HTTP/1.1 Host: api.academicbenchmarks.com Authorization: Bearer {access_token} ``` ### Response #### Success Response (200) - **id** (string) - The JSON API ID (same as AB GUID) - **type** (string) - Resource type identifier - **attributes** (object) - Topic metadata including title, description, etc. - **relationships** (object) - Related Standards and Topics #### Response Example ```json { "data": { "id": "AB1234567890", "type": "topics", "attributes": { "title": "Mathematics", "description": "Mathematical concepts and principles" }, "relationships": { "standards": { "data": [ { "type": "standards", "id": "AB0987654321" } ] } } } } ``` ``` -------------------------------- ### Install and Upgrade DAP CLI Source: https://developerdocs.instructure.com/services/dap/dap-cli-readme Commands to install and upgrade the DAP CLI client using pip. It also shows how to include specific database integrations. ```bash dap --version pip install --upgrade instructure-dap-client pip install --upgrade "instructure-dap-client[postgresql,mysql]" ``` -------------------------------- ### POST /api/v1/programs Source: https://developerdocs.instructure.com/services/catalog/openapi/programs Creates a new program in the system. Provide necessary details in the request body to initialize the program. Returns the created program upon success. ```APIDOC ## POST /api/v1/programs ### Description Creates a new program with the provided attributes. This is the entry point for adding programs to the system. ### Method POST ### Endpoint /api/v1/programs ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **name** (string) - Required - Name of the new program. - **description** (string) - Optional - Description of the program. ### Request Example { "name": "New Program", "description": "Description of new program" } ### Response #### Success Response (201) - **id** (integer) - ID of the created program. - **name** (string) - Program name. #### Response Example { "id": 2, "name": "New Program", "description": "Description of new program" } ``` -------------------------------- ### GET /asset_definitions/{guid} Source: https://developerdocs.instructure.com/services/ab-connect/reference/asset-definitions Retrieves the details of a specific Asset Definition resource by appending the AB GUID to the path. This endpoint requires Partner Authentication Credentials. ```APIDOC ## GET /asset_definitions/{guid} ### Description Retrieves the details of a specific Asset Definition resource based on its GUID. ### Method GET ### Endpoint /asset_definitions/{guid} ### Parameters #### Path Parameters - **guid** (string) - Required - The GUID of the Asset Definition to retrieve. #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **asset_definition** (object) - The requested Asset Definition details. #### Response Example Refer to the openapi.yml file for example response. ``` -------------------------------- ### GET /assets/{guid} Source: https://developerdocs.instructure.com/services/ab-connect/reference/assets Retrieves the complete details of a specific asset using its AB GUID. If you only have your organization's client ID, you can search by client_id to retrieve the AB GUID first. ```APIDOC ## GET /assets/{guid} ### Description Retrieves the complete details of a specific asset using its AB GUID. If you only have your organization's client ID, you can search by client_id to retrieve the AB GUID first. ### Method GET ### Endpoint /assets/{guid} ### Parameters #### Path Parameters - **guid** (string) - Required - AB GUID of the asset to retrieve ### Request Example No request body required - this is a GET request ### Response #### Success Response (200) - Asset details including all metadata and relationships #### Response Example { "asset": "Complete asset object with all fields" } ``` -------------------------------- ### Configure Temporary Storage Directory - Shell Source: https://developerdocs.instructure.com/services/dap/dap-cli-readme/dap-cli-getting-started Configures the temporary storage directory for data processing operations. Requires PostgreSQL connection string and specifies target database namespace and tables. The command sets up the working directory before performing database operations. ```shell dap syncdb --temp-dir /new/temp/location --connection-string postgresql://user:password@localhost/mydb --namespace canvas --table accounts,users ``` -------------------------------- ### GET /standards/{guid}/concepts Source: https://developerdocs.instructure.com/services/ab-connect/reference/relationships Retrieves related concepts for a standard. ```APIDOC ## GET /standards/{guid}/concepts ### Description Retrieves the related concepts for a given standard. ### Method GET ### Endpoint /standards/{guid}/concepts ### Parameters #### Path Parameters - **guid** (string) - Required - The GUID of the standard. #### Query Parameters None #### Request Body None ### Request Example { "guid": "standard_guid_value" } ### Response #### Success Response (200) - **concepts** (array) - An array of concept objects. #### Response Example { "concepts": [ { "field1": "example_value" } ] } ``` -------------------------------- ### GET /standards/{guid}/topics Source: https://developerdocs.instructure.com/services/ab-connect/reference/relationships Retrieves related topics for a standard. ```APIDOC ## GET /standards/{guid}/topics ### Description Retrieves the related topics for a given standard. ### Method GET ### Endpoint /standards/{guid}/topics ### Parameters #### Path Parameters - **guid** (string) - Required - The GUID of the standard. #### Query Parameters None #### Request Body None ### Request Example { "guid": "standard_guid_value" } ### Response #### Success Response (200) - **topics** (array) - An array of topic objects. #### Response Example { "topics": [ { "field1": "example_value" } ] } ``` -------------------------------- ### POST /api/v1/courses Source: https://developerdocs.instructure.com/services/catalog/openapi/courses Creates a new course. This endpoint allows administrators or authorized users to set up a new course with initial details like name, code, and settings. Returns the created course object. ```APIDOC ## POST /api/v1/courses ### Description Creates a new course. ### Method POST ### Endpoint /api/v1/courses ### Parameters #### Path Parameters #### Query Parameters #### Request Body - **name** (string) - Required - Course name - **course_code** (string) - Optional - Course code ### Request Example { "name": "Sample Course", "course_code": "MATH101" } ### Response #### Success Response (201) - **id** (integer) - Course ID #### Response Example { "id": 123, "name": "Sample Course" } ``` -------------------------------- ### Get Standard by GUID, including Related Courses Source: https://developerdocs.instructure.com/services/ab-connect/introduction/how-to Retrieves a specific standard by its GUID and includes a list of courses that reference this standard. ```APIDOC ## GET /rest/v4.1/standards/{guid} ### Description Retrieves a specific standard by its GUID. This endpoint can also include a list of courses that reference this standard via the `related_courses` relationship. ### Method GET ### Endpoint `/rest/v4.1/standards/{guid}` ### Parameters #### Path Parameters - **guid** (string) - Required - The unique identifier of the standard. #### Query Parameters - **fields[standards]** (string) - Optional - Comma-separated list of fields to include for the standard, e.g., `statement,number,section,related_courses`. - **include** (string) - Optional - Specifies related resources to include, e.g., `related_courses`. ### Request Example ``` GET /rest/v4.1/standards/C3B5C384-E1BF-11DC-A10B-B5479DFF4B22?fields[standards]=statement,number,section,related_courses&include=related_courses ``` ### Response #### Success Response (200) - **statement** (string) - The statement of the standard. - **number** (string) - The number or code of the standard. - **section** (string) - The section the standard belongs to. - **related_courses** (array) - A list of courses that use this standard. #### Response Example ```json { "statement": "Example Standard Statement", "number": "1.2.3", "section": "Example Section", "related_courses": [ { "id": "COURSE-GUID-1", "name": "Example Course 1" } ] } ``` ``` -------------------------------- ### DAP CLI Basic Syntax and Help Source: https://developerdocs.instructure.com/services/dap/dap-cli-readme Demonstrates the basic command structure for the DAP CLI and how to access help information directly from the terminal. ```bash dap [arguments] [command] [flags] dap --help ``` -------------------------------- ### Configure Logging (Python) Source: https://developerdocs.instructure.com/services/dap/lib-index/lib-examples This snippet demonstrates how to configure logging using the `dap.log` utility functions. It allows you to set the log level, format, and output file for consistent logging across modules. ```Python configure_logging( level="DEBUG", format="json", file="my_client_app.log", namespace="canvas", table="accounts", client_id=client_id, ) ``` -------------------------------- ### Get Group Permissions - JavaScript Source: https://developerdocs.instructure.com/services/canvas/resources/groups Parses the JSON response from the Get Group Permissions API endpoint. This example assumes a successful API call and demonstrates how to access the boolean permission values. ```javascript { 'read_roster': 'true', 'send_messages_all': 'false' } ``` -------------------------------- ### GET /rostering/terms Source: https://developerdocs.instructure.com/services/datasync/interop-data-oas Retrieves a list of all academic terms/semesters in the system with start and end dates. ```APIDOC ## GET /rostering/terms ### Description Retrieves a list of all academic terms with their start and end dates, status, and associated academic year information. ### Method GET ### Endpoint /rostering/terms ### Parameters #### Query Parameters - **status** (string) - Optional - Filter by term status (active/inactive) - **academicYear** (string) - Optional - Filter by academic year - **limit** (integer) - Optional - Maximum number of records to return - **offset** (integer) - Optional - Number of records to skip for pagination ### Request Example { "status": "active", "limit": 10 } ### Response #### Success Response (200) - **terms** (array) - List of term objects - **totalCount** (integer) - Total number of terms available #### Response Example { "terms": [ { "id": "fall2024", "title": "Fall 2024", "startDate": "2024-08-15", "endDate": "2024-12-15", "status": "active", "academicYear": "2024-2025" } ], "totalCount": 8 } ``` -------------------------------- ### Fetch table data with snapshot query in Python Source: https://developerdocs.instructure.com/services/dap/lib-index/lib-examples Demonstrates performing a snapshot query to get the full contents of a table. The output format can be specified, with JSONL or Parquet recommended. ```python import os from dap.api import DAPClient from dap.dap_types import Format, SnapshotQuery from dap.log import configure_logging output_directory = os.getcwd() configure_logging() async with DAPClient() as session: query = SnapshotQuery(format=Format.JSONL, mode=None) await session.download_table_data( "canvas", "accounts", query, output_directory, decompress=True ) ``` -------------------------------- ### Get Standard by GUID, including Course Standards Source: https://developerdocs.instructure.com/services/ab-connect/introduction/how-to Retrieves a specific standard by its GUID and includes details about the standards that comprise a course if the publication type is set to 'course'. ```APIDOC ## GET /rest/v4.1/standards/{guid} ### Description Retrieves a specific standard by its GUID. This endpoint can also include associated course standards if the publication is of type 'course'. ### Method GET ### Endpoint `/rest/v4.1/standards/{guid}` ### Parameters #### Path Parameters - **guid** (string) - Required - The unique identifier of the standard. #### Query Parameters - **fields[standards]** (string) - Optional - Comma-separated list of fields to include for the standard, e.g., `statement,number,section,course_standards`. - **include** (string) - Optional - Specifies related resources to include, e.g., `course_standards`. ### Request Example ``` GET /rest/v4.1/standards/2FADED92-647D-4183-89C1-17F28CF065ED?fields[standards]=statement,number,section,course_standards&include=course_standards ``` ### Response #### Success Response (200) - **statement** (string) - The statement of the standard. - **number** (string) - The number or code of the standard. - **section** (string) - The section the standard belongs to. - **course_standards** (array) - A list of standards that are part of this course. #### Response Example ```json { "statement": "Example Standard Statement", "number": "1.2.3", "section": "Example Section", "course_standards": [ { "statement": "Course Standard 1", "number": "CS.1", "section": "Course Section 1" } ] } ``` ``` -------------------------------- ### Configure client library logging with configure_logging (Python) Source: https://developerdocs.instructure.com/services/dap/lib-index/lib-examples Sets up structured JSON logging for the client library using the configure_logging helper. Parameters allow customizing the log level, format, output file, and contextual identifiers such as namespace, table, and client ID. Defaults are applied for any omitted arguments. ```Python configure_logging( level="DEBUG", format="json", file="my_client_app.log", namespace="canvas", table="accounts", client_id=client_id, ) ``` -------------------------------- ### Authentication Example Source: https://developerdocs.instructure.com/services/catalog Demonstrates how to authenticate API requests using an API key provided as a header. It's crucial to use SSL for all requests to protect your API key. ```APIDOC ## Authentication Use the following header to authenticate your requests: ``` Authorization: Token token="YOUR_API_KEY" ``` **Example using cURL:** ```bash curl https://[URL]/api/v1/products -H 'Authorization: Token token="my-api-key"' ``` ``` -------------------------------- ### Get Course Late Policy (API Example) Source: https://developerdocs.instructure.com/services/canvas/resources/late_policy Demonstrates how to retrieve the late policy for a specific course using a GET request to the Instructure API. The response contains the LatePolicy object. ```bash GET /api/v1/courses/:id/late_policy ``` ```javascript { "late_policy": LatePolicy } ``` -------------------------------- ### GET /standards/{guid}/{relationship} Source: https://developerdocs.instructure.com/services/ab-connect/reference/relationships Filters and pages through related Standards. Allows filtering and sorting on relationship properties. ```APIDOC ## GET /standards/{guid}/{relationship} ### Description Allows filtering and paging through related Standards. ### Method GET ### Endpoint /standards/{guid}/{relationship} ### Parameters #### Path Parameters - **guid** (string) - Required - The GUID of the standard. - **relationship** (string) - Required - The relationship to filter by. #### Query Parameters None #### Request Body None ### Request Example { "guid": "standard_guid_value", "relationship": "related_standards" } ### Response #### Success Response (200) - **standards** (array) - An array of standard objects. #### Response Example { "standards": [ { "field1": "example_value" } ] } ``` -------------------------------- ### Set Database Connection String Environment Variable Source: https://developerdocs.instructure.com/services/dap/dap-cli-readme/dap-cli-getting-started Store the database connection string in an environment variable for secure access. The connection string follows the format: protocol://username:password@host:port/database_name and supports PostgreSQL, MySQL, and MSSQL databases. Use export for macOS/Linux and set for Windows. ```shell # MacOS/Linux - set database connection string export DAP_CONNECTION_STRING=postgresql://user:password@localhost:5432/mydatabase # Windows - set database connection string set DAP_CONNECTION_STRING=postgresql://user:password@localhost:5432/mydatabase # Example connection string formats: # postgresql://user:password@host:5432/mydatabase # mysql://user:password@host:3306/mydatabase # mssql://user:password@host:1433/mydatabase ``` -------------------------------- ### GET /standards Source: https://developerdocs.instructure.com/services/ab-connect/introduction/related-objects Retrieves a list of standards with selectable fields and filters. Example includes peers and alignment criteria. ```APIDOC ## GET /standards\n\n### Description\nRetrieves a list of standards with selectable fields and filters. Example filters standards that have peers and are alignable, and includes peer data.\n\n### Method\nGET\n\n### Endpoint\nhttps://api.abconnect.instructure.com/rest/v4.1/standards\n\n### Parameters\n#### Query Parameters\n- **fields[standards]** (string) - Optional - Comma‑separated list of fields to return (e.g., peers,statement,number).\n- **filter[standards]** (string) - Optional - OData filter expression (e.g., not isempty(peers) and utilizations.type eq alignable).\n- **include** (string) - Optional - Related resources to include (e.g., peers).\n\n### Request Example\nGET https://api.abconnect.instructure.com/rest/v4.1/standards?fields[standards]=peers,statement,number&filter[standards]=not isempty(peers) and utilizations.type eq alignable&include=peers\n\n### Response\n#### Success Response (200)\n- **data** (array) - List of standard objects with requested fields.\n- **links** (object) - Pagination links if applicable.\n\n### Response Example\n{\n "data": [\n {\n "id": "00003506-B001-11DA-93BA-9A7258581090",\n "type": "standards",\n "relationships": {\n "peers": {\n "data": [ ... ],\n "links": { ... }\n }\n }\n }\n ]\n} ```