Title: | 'Canvas' LMS API Integration |
---|---|
Description: | Allow R users to interact with the 'Canvas' Learning Management System (LMS) API (see <https://canvas.instructure.com/doc/api/all_resources.html> for details). It provides a set of functions to access and manipulate course data, assignments, grades, users, and other resources available through the 'Canvas' API. |
Authors: | Tomer Iwan [aut, cre],
Niels Smits [ctb] |
Maintainer: | Tomer Iwan <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.4 |
Built: | 2025-03-12 20:21:08 UTC |
Source: | https://github.com/vusaverse/vvcanvas |
Get the Canvas API key from the environment variable
canvas_api_key()
canvas_api_key()
The Canvas API key stored in the CANVAS_API_KEY environment variable.
This function handles authentication with the Canvas LMS API.
It uses the provided API key and base URL, or falls back to the CANVAS_API_KEY
and CANVAS_BASE_URL
environment variables if none are provided.
canvas_authenticate(api_key = canvas_api_key(), base_url = canvas_base_url())
canvas_authenticate(api_key = canvas_api_key(), base_url = canvas_base_url())
api_key |
The API key for authenticating with the Canvas LMS API. Defaults to the |
base_url |
The base URL of the Canvas instance. Defaults to the |
A list containing the authenticated 'api_key' and 'base_url'.
The function verifies authentication by making a test request to the /api/v1/users/self
endpoint of the Canvas instance.
If the response status code is not 200, it throws an error message indicating that authentication failed.
## Not run: # Authenticate with the Canvas LMS API api_key <- "your_api_key" base_url <- "https://canvas.example.com" canvas <- canvas_authenticate(api_key, base_url) ## End(Not run)
## Not run: # Authenticate with the Canvas LMS API api_key <- "your_api_key" base_url <- "https://canvas.example.com" canvas <- canvas_authenticate(api_key, base_url) ## End(Not run)
Get the Canvas base URL from the environment variable
canvas_base_url()
canvas_base_url()
The Canvas base URL stored in the CANVAS_BASE_URL environment variable.
Creates a new assignment group in a specific course using the Canvas LMS API.
create_assignment_group(canvas, course_id, group_name, group_position = NULL)
create_assignment_group(canvas, course_id, group_name, group_position = NULL)
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
course_id |
The ID of the course in which to create the assignment group. |
group_name |
The name of the assignment group. |
group_position |
The position of the assignment group in the course (optional). |
A confirmation message that the assignment group has been created.
This function retrieves data from various endpoints for a specific course in the Canvas LMS API and stores the data as JSON files in a specified storage location.
create_course_datalake(canvas, course_id, storage_location)
create_course_datalake(canvas, course_id, storage_location)
canvas |
An object containing the Canvas API key and base URL, obtained through the |
course_id |
The ID of the course for which to create the data lake. |
storage_location |
The path to the storage location where the data files will be saved. |
NULL.
This function retrieves data from various endpoints. Access to certain endpoints may require specific roles.
Creates a new course section in a specific course using the Canvas LMS API.
create_course_section( canvas, course_id, section_name, section_start_date = NULL, section_end_date = NULL )
create_course_section( canvas, course_id, section_name, section_start_date = NULL, section_end_date = NULL )
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
course_id |
The ID of the course in which to create the section. |
section_name |
The name of the section. |
section_start_date |
(Optional) The start date of the section. |
section_end_date |
(Optional) The end date of the section. |
A confirmation message that the section has been created.
Creates a new folder in a specific course using the Canvas LMS API.
create_folder(canvas, course_id, folder_name, parent_folder_id = NULL)
create_folder(canvas, course_id, folder_name, parent_folder_id = NULL)
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
course_id |
The ID of the course in which to create the folder. |
folder_name |
The name of the folder. |
parent_folder_id |
(Optional) The ID of the parent folder in which to create the folder. |
A confirmation message that the folder has been created.
Creates a new group category in a specific course using the Canvas LMS API.
create_group_category( canvas, course_id, category_name, allow_self_signup = FALSE )
create_group_category( canvas, course_id, category_name, allow_self_signup = FALSE )
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
course_id |
The ID of the course in which to create the group category. |
category_name |
The name of the group category. |
allow_self_signup |
(Optional) Whether to allow self-signup for groups in the category. Defaults to FALSE. |
A confirmation message that the group category has been created.
Creates a new module in a specific course using the Canvas LMS API.
create_module(canvas, course_id, module_name, position = NULL)
create_module(canvas, course_id, module_name, position = NULL)
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
course_id |
The ID of the course in which to create the module. |
module_name |
The title of the module. |
position |
(Optional) The position of this module in the course |
A confirmation message that the module has been created.
Creates a new item in a specific module in a specifc course using the Canvas LMS API.
create_module_item( canvas, course_id, module_id, item_title, item_type = "Page", position = NULL, page_url = NULL, page_id = NULL )
create_module_item( canvas, course_id, module_id, item_title, item_type = "Page", position = NULL, page_url = NULL, page_id = NULL )
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
course_id |
The ID of the course in which to create the module item. |
module_id |
The ID of the module in which to create the item. |
item_title |
The title of the new item within the module. |
item_type |
The type of item. Defaults to "Page". |
position |
(Optional) The position of the item within the module. Defaults to 1. |
page_url |
(Optional) The url of the page. |
page_id |
(Optional) The id of the page. |
A confirmation message that the page has been created.
Creates a new page in a specific course using the Canvas LMS API.
create_page(canvas, course_id, page_title, page_body, published = FALSE)
create_page(canvas, course_id, page_title, page_body, published = FALSE)
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
course_id |
The ID of the course in which to create the page. |
page_title |
The title of the page. |
page_body |
The body/content of the page. |
published |
(Optional) Whether the page should be published. Defaults to FALSE. |
A confirmation message that the page has been created.
Deletes an existing course section using the Canvas LMS API.
delete_course_section(canvas, section_id)
delete_course_section(canvas, section_id)
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
section_id |
The ID of the section to delete. |
A confirmation message that the section has been deleted.
Deletes a page in a specific course using the Canvas LMS API.
delete_page(canvas, course_id, page_id)
delete_page(canvas, course_id, page_id)
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
course_id |
The ID of the course in which to delete the page. |
page_id |
The ID of the page. |
A confirmation message that the page has been deleted.
This function downloads a file from a specified URL and saves it locally.
download_course_file(canvas, file_url, download_path)
download_course_file(canvas, file_url, download_path)
canvas |
An object containing the Canvas API key and base URL, obtained through the |
file_url |
The URL of the file to download. |
download_path |
The path where the file should be downloaded. |
The path of the downloaded file.
## Not run: # Download a file from a given URL canvas <- canvas_authenticate(api_key, base_url) file_url <- "https://example.com/file.pdf" download_path <- "path/to/save/file.pdf" file_path <- download_course_file(canvas, file_url, download_path) ## End(Not run)
## Not run: # Download a file from a given URL canvas <- canvas_authenticate(api_key, base_url) file_url <- "https://example.com/file.pdf" download_path <- "path/to/save/file.pdf" file_path <- download_course_file(canvas, file_url, download_path) ## End(Not run)
Modifies an existing course section using the Canvas LMS API.
edit_section( canvas, section_id, section_name = NULL, sis_section_id = NULL, integration_id = NULL, section_start_date = NULL, section_end_date = NULL, restrict_enrollments_to_section_dates = NULL, override_sis_stickiness = NULL )
edit_section( canvas, section_id, section_name = NULL, sis_section_id = NULL, integration_id = NULL, section_start_date = NULL, section_end_date = NULL, restrict_enrollments_to_section_dates = NULL, override_sis_stickiness = NULL )
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
section_id |
The ID of the section to edit. |
section_name |
The new name of the section (optional). |
sis_section_id |
The new SIS ID of the section (optional). |
integration_id |
The new integration ID of the section (optional). |
section_start_date |
The new start date of the section (optional). |
section_end_date |
The new end date of the section (optional). |
restrict_enrollments_to_section_dates |
Whether to restrict user enrollments to the start and end dates of the section (optional). |
override_sis_stickiness |
Whether to override SIS stickiness (optional). |
A confirmation message that the section has been edited.
Retrieves a paginated list of accounts that the current user can view or manage.
get_accounts(canvas, include = NULL, per_page = 100)
get_accounts(canvas, include = NULL, per_page = 100)
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
include |
A vector of additional information to include. Default is NULL. |
per_page |
Number of accounts to retrieve per page. Default is 100. |
A list of accounts retrieved from the Canvas LMS API.
This function retrieves a paginated list of all courses visible in the public index using the Canvas LMS API. NOTE This function might take a while to finish.
get_all_courses(canvas, per_page = 100)
get_all_courses(canvas, per_page = 100)
canvas |
An object containing the Canvas API key and base URL, obtained through the |
per_page |
(Optional) The number of courses to retrieve per page of results (default is 100). |
A data frame of courses visible in the public index.
Retrieves the course-level assignment data for a specific course from the Canvas LMS API.
get_assignment_data(canvas, course_id, per_page = 100)
get_assignment_data(canvas, course_id, per_page = 100)
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
course_id |
The ID of the course for which to retrieve the assignment data. |
per_page |
Number of assignment data to retrieve per page. Default is 100. |
A list of assignment data retrieved from the Canvas LMS API.
Retrieves detailed information about a specific assignment from the Canvas LMS API.
get_assignment_details(canvas, course_id, assignment_id)
get_assignment_details(canvas, course_id, assignment_id)
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
course_id |
The ID of the course in which the assignment resides. |
assignment_id |
The ID of the assignment for which to retrieve the details. |
A dataframe containing the detailed information about the assignment.
This function retrieves the assignment groups within a specific course in the Canvas LMS API.
get_assignment_groups(canvas, course_id, per_page = 100)
get_assignment_groups(canvas, course_id, per_page = 100)
canvas |
An object containing the Canvas API key and base URL, obtained through the |
course_id |
The ID of the course for which to fetch the assignment groups. |
per_page |
The number of entries to show per page. |
A list of assignment groups within the specified course.
This function retrieves a list of assignment submissions for a specific course in the Canvas LMS API.
get_assignment_submissions( canvas, course_id, assignment_id = NULL, per_page = 100 )
get_assignment_submissions( canvas, course_id, assignment_id = NULL, per_page = 100 )
canvas |
An object containing the Canvas API key and base URL, obtained through the |
course_id |
The ID of the course for which to list assignment submissions. |
assignment_id |
(Optional) The ID of a specific assignment for which to list submissions. |
per_page |
(Optional) The number of submissions to retrieve per page of results (default is 100). |
A data frame of assignment submissions for the specified course and assignment.
Fetches a list of assignments within a specific course from the Canvas LMS API.
get_assignments(canvas, course_id)
get_assignments(canvas, course_id)
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
course_id |
The ID of the course for which to retrieve the assignments. |
A list of assignments retrieved from the Canvas LMS API.
Retrieve the paginated list of calendar events or assignments for the current user.
get_calendar_events( canvas, type = "event", start_date = NULL, end_date = NULL, undated = FALSE, all_events = FALSE, context_codes = NULL, excludes = NULL, includes = NULL, important_dates = FALSE, blackout_date = FALSE )
get_calendar_events( canvas, type = "event", start_date = NULL, end_date = NULL, undated = FALSE, all_events = FALSE, context_codes = NULL, excludes = NULL, includes = NULL, important_dates = FALSE, blackout_date = FALSE )
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
type |
The type of events to retrieve. Default is "event". Allowed values: event, assignment. |
start_date |
Only return events since the start_date (inclusive). Defaults to today. |
end_date |
Only return events before the end_date (inclusive). Defaults to start_date. |
undated |
Defaults to false (dated events only). If true, only return undated events and ignore start_date and end_date. |
all_events |
Defaults to false (uses start_date, end_date, and undated criteria). If true, all events are returned, ignoring start_date, end_date, and undated criteria. |
context_codes |
List of context codes of courses, groups, users, or accounts whose events you want to see. If not specified, defaults to the current user (i.e personal calendar, no course/group events). |
excludes |
Array of attributes to exclude. Possible values are “description”, “child_events” and “assignment”. |
includes |
Array of optional attributes to include. Possible values are “web_conference” and if calendar_series flag is on, “series_natural_language”. |
important_dates |
Defaults to false. If true, only events with important dates set to true will be returned. |
blackout_date |
Defaults to false. If true, only events with blackout date set to true will be returned. |
A data frame of calendar events retrieved from the Canvas LMS API.
This function retrieves a list of announcements for a specific course in the Canvas LMS API.
get_course_announcements(canvas, course_id, per_page = 100)
get_course_announcements(canvas, course_id, per_page = 100)
canvas |
An object containing the Canvas API key and base URL, obtained through the |
course_id |
The ID of the course for which to retrieve announcements. |
per_page |
(Optional) The number of announcements to retrieve per page of results (default is 100). |
A data frame of course announcements.
Retrieves detailed information about a specific course from the Canvas LMS API.
get_course_details(canvas, course_id)
get_course_details(canvas, course_id)
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
course_id |
The ID of the course for which to retrieve the details. |
A dataframe containing the detailed information about the course.
This function retrieves the enrollments of students and other roles in a specific course in the Canvas LMS API.
get_course_enrollments(canvas, course_id, per_page = 100)
get_course_enrollments(canvas, course_id, per_page = 100)
canvas |
An object containing the Canvas API key and base URL, obtained through the |
course_id |
The ID of the course for which to fetch the enrollments. |
per_page |
(Optional) The number of enrollments to retrieve per page of results (default is 100). |
A data frame of course enrollments for the specified course.
This function retrieves a list of files within a specific course in the Canvas LMS API.
get_course_files(canvas, course_id, per_page = 100)
get_course_files(canvas, course_id, per_page = 100)
canvas |
An object containing the Canvas API key and base URL, obtained through the |
course_id |
The ID of the course for which to fetch the files. |
per_page |
(Optional) The number of files to retrieve per page of results (default is 100). |
A data frame of files within the specified course.
This function retrieves a list of folders for a specific course in the Canvas LMS API.
get_course_folders(canvas, course_id, per_page = 100)
get_course_folders(canvas, course_id, per_page = 100)
canvas |
An object containing the Canvas API key and base URL, obtained through the |
course_id |
The ID of the course for which to retrieve folders. |
per_page |
Number of courses to retrieve per page. Default is 100. |
A data frame of course folders.
This function retrieves the list of groups in a specific course in the Canvas LMS API.
get_course_groups(canvas, course_id, per_page = 100)
get_course_groups(canvas, course_id, per_page = 100)
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
course_id |
The ID of the course for which to fetch the groups. |
per_page |
(Optional) The number of groups to retrieve per page of results (default is 100). |
A data frame of groups in the specified course.
This function retrieves the media objects associated with a specific course in the Canvas LMS API.
get_course_media_objects(canvas, course_id, per_page = 100)
get_course_media_objects(canvas, course_id, per_page = 100)
canvas |
An object containing the Canvas API key and base URL, obtained through the |
course_id |
The ID of the course for which to fetch the media objects. |
per_page |
The number of entries to show per page. |
A data frame containing the media objects in the specified course.
This function retrieves the pages within a specific course in the Canvas LMS API.
get_course_pages(canvas, course_id, per_page = 100)
get_course_pages(canvas, course_id, per_page = 100)
canvas |
An object containing the Canvas API key and base URL, obtained through the |
course_id |
The ID of the course for which to fetch the pages. |
per_page |
(Optional) The number of pages to retrieve per page of results (default is 50). |
A list of pages within the specified course.
Fetches the participation data for a specific course from the Canvas LMS API.
get_course_participation(canvas, course_id)
get_course_participation(canvas, course_id)
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
course_id |
The ID of the course for which to retrieve the participation data. |
The participation data for the specified course retrieved from the Canvas LMS API.
This function retrieves a list of quizzes for a specific course in the Canvas LMS API.
get_course_quizzes(canvas, course_id, per_page = 100)
get_course_quizzes(canvas, course_id, per_page = 100)
canvas |
An object containing the Canvas API key and base URL, obtained through the |
course_id |
The ID of the course for which to retrieve quizzes. |
per_page |
(Optional) The number of quizzes to retrieve per page of results (default is 100). |
A data frame of course quizzes.
This function retrieves a list of sections for a specific course in the Canvas LMS API.
get_course_sections(canvas, course_id, per_page = 100)
get_course_sections(canvas, course_id, per_page = 100)
canvas |
An object containing the Canvas API key and base URL, obtained through the |
course_id |
The ID of the course for which to retrieve sections. |
per_page |
(Optional) The number of sections to retrieve per page of results (default is 100). |
A data frame of course sections.
This function retrieves the list of students enrolled in a specific course in the Canvas LMS API.
get_course_students(canvas, course_id, per_page = 100)
get_course_students(canvas, course_id, per_page = 100)
canvas |
An object containing the Canvas API key and base URL, obtained through the |
course_id |
The ID of the course for which to fetch the students. |
per_page |
(Optional) The number of students to retrieve per page of results (default is 100). |
A data frame of students enrolled in the specified course.
This function retrieves the users enrolled in a specific course in the Canvas LMS API.
get_course_users( canvas, course_id, per_page = 100, include = c("enrollments", "locked", "avatar_url", "test_student", "bio", "custom_links", "current_grading_period_scores", "uuid") )
get_course_users( canvas, course_id, per_page = 100, include = c("enrollments", "locked", "avatar_url", "test_student", "bio", "custom_links", "current_grading_period_scores", "uuid") )
canvas |
An object containing the Canvas API key and base URL, obtained through the |
course_id |
The ID of the course for which to fetch the users. |
per_page |
The number of entries to show per page. |
include |
Optional parameters to include in the response. Possible values: "enrollments", "locked", "avatar_url", "test_student", "bio", "custom_links", "current_grading_period_scores", "uuid". |
A data frame containing the users in the specified course.
Retrieves a list of courses from the Canvas LMS API.
get_courses(canvas, per_page = 100)
get_courses(canvas, per_page = 100)
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
per_page |
Number of courses to retrieve per page. Default is 100. |
A list of courses retrieved from the Canvas LMS API.
Retrieves the department-level grade data for a specific account and term from the Canvas LMS API.
get_department_grade_data( canvas, account_id, type = "current", term_id = NULL, per_page = 100 )
get_department_grade_data( canvas, account_id, type = "current", term_id = NULL, per_page = 100 )
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
account_id |
The ID of the account for which to retrieve the grade data. |
type |
The type of courses to include in the data. Can be 'current', 'completed', or 'term'. |
term_id |
The ID of the term for which to retrieve the grade data. Only used when type is 'terms/<term_id>'. |
per_page |
Number of grade data to retrieve per page. Default is 100. |
A data frame of grade data retrieved from the Canvas LMS API.
Retrieves the department-level participation data for a specific account and term from the Canvas LMS API.
get_department_participation_data( canvas, account_id, type = "current", term_id = NULL, per_page = 100 )
get_department_participation_data( canvas, account_id, type = "current", term_id = NULL, per_page = 100 )
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
account_id |
The ID of the account for which to retrieve the participation data. |
type |
The type of courses to include in the data. Can be 'current', 'completed', or 'term'. |
term_id |
The ID of the term for which to retrieve the participation data. Only used when type is 'terms/<term_id>'. |
per_page |
Number of participation data to retrieve per page. Default is 100. |
A data frame of participation data retrieved from the Canvas LMS API.
Retrieves department-level statistics for a specific account and term from the Canvas LMS API.
get_department_statistics(canvas, account_id, type = "current", term_id = NULL)
get_department_statistics(canvas, account_id, type = "current", term_id = NULL)
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
account_id |
The ID of the account for which to retrieve the statistics. |
type |
The type of courses to include in the data. Can be 'current', 'completed', or 'term'. |
term_id |
The ID of the term for which to retrieve the statistics. Only used when type is 'terms/<term_id>'. |
A list of department-level statistics retrieved from the Canvas LMS API.
Retrieves department-level statistics for a specific account and term from the Canvas LMS API.
get_department_statistics_by_subaccount( canvas, account_id, type = "current", term_id = NULL )
get_department_statistics_by_subaccount( canvas, account_id, type = "current", term_id = NULL )
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
account_id |
The ID of the account for which to retrieve the statistics. |
type |
The type of courses to include in the data. Can be 'current', 'completed', or 'term'. |
term_id |
The ID of the term for which to retrieve the statistics. Only used when type is 'terms/<term_id>'. |
A list of department-level statistics retrieved from the Canvas LMS API.
This function retrieves the discussion topics within a specific course in the Canvas LMS API.
get_discussions(canvas, course_id, per_page = 100)
get_discussions(canvas, course_id, per_page = 100)
canvas |
An object containing the Canvas API key and base URL, obtained through the |
course_id |
The ID of the course for which to fetch the discussion topics. |
per_page |
The number of entries to show |
A list of discussion topics within the specified course.
Retrieves the data of favorite courses for the authenticated user using the Canvas LMS API.
get_favorite_courses(canvas, exclude_blueprint_courses = NULL)
get_favorite_courses(canvas, exclude_blueprint_courses = NULL)
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
exclude_blueprint_courses |
When set, only return courses that are not configured as blueprint courses (optional). |
The dataframe of favorite courses.
This function retrieves the group categories for a specific context (e.g., course) in the Canvas LMS API.
get_group_categories(canvas, course_id)
get_group_categories(canvas, course_id)
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
course_id |
The ID of the course for which to retrieve the group categories. |
A data frame of group categories in the specified context.
This function retrieves information about a specific group in the Canvas LMS API.
get_group_info(canvas, group_id)
get_group_info(canvas, group_id)
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
group_id |
The ID of the group for which to retrieve the information. |
A list containing the information about the specified group.
This function retrieves the memberships for a specific group in the Canvas LMS API.
get_group_memberships(canvas, group_id)
get_group_memberships(canvas, group_id)
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
group_id |
The ID of the group for which to retrieve the memberships. |
A data frame of memberships in the specified group.
This function retrieves the users in a specific group in the Canvas LMS API.
get_group_users(canvas, group_id)
get_group_users(canvas, group_id)
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
group_id |
The ID of the group for which to retrieve the users. |
A data frame of users in the specified group.
This function retrieves the items within a specific module of a course in the Canvas LMS API.
get_module_items(canvas, course_id, module_id)
get_module_items(canvas, course_id, module_id)
canvas |
An object containing the Canvas API key and base URL, obtained through the |
course_id |
The ID of the course containing the module. |
module_id |
The ID of the module for which to fetch the items. |
A list of items within the specified module.
This function retrieves the modules within a specific course in the Canvas LMS API.
get_modules(canvas, course_id, per_page = 100)
get_modules(canvas, course_id, per_page = 100)
canvas |
An object containing the Canvas API key and base URL, obtained through the |
course_id |
The ID of the course for which to fetch the modules. |
per_page |
The number of entries to show |
A list of modules within the specified course.
This function retrieves the content body of a specified page within a course in the Canvas LMS API.
get_page_content(canvas, course_id, page_id, return_as_plain_text = TRUE)
get_page_content(canvas, course_id, page_id, return_as_plain_text = TRUE)
canvas |
An object containing the Canvas API key and base URL, obtained through the |
course_id |
The ID of the course to which the page belongs. |
page_id |
The ID of the page for which to fetch the content body. |
return_as_plain_text |
A logical value indicating whether to return the content as plain text (default is TRUE). |
The content body of the specified page, either as plain text or raw HTML.
This function retrieves a paginated list of the roles available to a specific account in the Canvas LMS system.
get_roles(canvas, account_id, per_page = 100)
get_roles(canvas, account_id, per_page = 100)
canvas |
A list containing the base URL and API key for the Canvas LMS instance. |
account_id |
The ID of the account for which you want to retrieve the roles. |
per_page |
The number of roles to retrieve per page (default is 100). |
A data frame containing the roles available to the specified account.
Retrieves information about a specific course section using the Canvas LMS API.
get_section_information(canvas, course_id, section_id)
get_section_information(canvas, course_id, section_id)
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
course_id |
The ID of the course. |
section_id |
The ID of the section. |
The information about the section.
This function retrieves a list of students enrolled in a specific section of a course in Canvas LMS.
get_section_students(canvas, section_id, per_page = 100)
get_section_students(canvas, section_id, per_page = 100)
canvas |
A list containing the Canvas API key and base URL, typically obtained through a |
section_id |
The ID of the section for which to retrieve students. |
per_page |
(Optional) The number of student records to retrieve per page of results. Defaults to 100. |
A data frame containing details of students enrolled in the specified section.
## Not run: canvas <- list(base_url = "https://your_canvas_instance.instructure.com", api_key = "your_api_key") section_id <- "67890" students <- get_section_students(canvas, section_id) print(students) ## End(Not run)
## Not run: canvas <- list(base_url = "https://your_canvas_instance.instructure.com", api_key = "your_api_key") section_id <- "67890" students <- get_section_students(canvas, section_id) print(students) ## End(Not run)
Retrieves the student summaries for a specific course from the Canvas LMS API.
get_student_summaries(canvas, course_id, per_page = 100)
get_student_summaries(canvas, course_id, per_page = 100)
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
course_id |
The ID of the course for which to retrieve the student summaries. |
per_page |
Number of student summaries to retrieve per page. Default is 100. |
A list of student summaries retrieved from the Canvas LMS API.
Retrieves user-in-a-course-level assignment data for a specific course and student from the Canvas LMS API.
get_user_course_assignment_data(canvas, course_id, student_id)
get_user_course_assignment_data(canvas, course_id, student_id)
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
course_id |
The ID of the course for which to retrieve the assignment data. |
student_id |
The ID of the student for which to retrieve the assignment data. |
A list of user-in-a-course-level assignment data retrieved from the Canvas LMS API.
Retrieves user-in-a-course-level messaging data for a specific course and student from the Canvas LMS API.
get_user_course_messaging_data(canvas, course_id, student_id)
get_user_course_messaging_data(canvas, course_id, student_id)
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
course_id |
The ID of the course for which to retrieve the messaging data. |
student_id |
The ID of the student for which to retrieve the messaging data. |
A list of user-in-a-course-level messaging data retrieved from the Canvas LMS API.
Retrieves user-in-a-course-level participation data for a specific course and student from the Canvas LMS API.
get_user_course_participation_data(canvas, course_id, student_id)
get_user_course_participation_data(canvas, course_id, student_id)
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
course_id |
The ID of the course for which to retrieve the participation data. |
student_id |
The ID of the student for which to retrieve the participation data. |
A list of user-in-a-course-level participation data retrieved from the Canvas LMS API.
This function retrieves a paginated list of all enrollment terms for a specified account in Canvas LMS.
list_all_enrollment_terms(canvas, account_id, per_page = 100)
list_all_enrollment_terms(canvas, account_id, per_page = 100)
canvas |
A list containing Canvas API configuration:
|
account_id |
The ID of the account for which to retrieve enrollment terms |
per_page |
The number of terms to retrieve per page (default is 100) |
A dataframe containing all enrollment terms details
Creates a new discussion topic in a specific course using the Canvas LMS API.
post_new_discussion( canvas, course_id, discussion_title, discussion_message, discussion_is_announcement = FALSE )
post_new_discussion( canvas, course_id, discussion_title, discussion_message, discussion_is_announcement = FALSE )
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
course_id |
The ID of the course in which to create the discussion. |
discussion_title |
The title of the discussion topic. |
discussion_message |
The initial message content of the discussion topic. |
discussion_is_announcement |
(Optional) Whether the discussion should be an announcement. Defaults to FALSE. |
A confirmation message that the discussion has been created.
Updates an existing page in a specific course using the Canvas LMS API.
update_page(canvas, course_id, page_id, page_params)
update_page(canvas, course_id, page_id, page_params)
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
course_id |
The ID of the course in which to create the page. |
page_id |
The ID of the page. |
page_params |
A named list of page parameters to update. This list can include:
|
A confirmation message that the page has been updated.
This function modifies an existing quiz in a specific course in the Canvas LMS API.
update_quiz(canvas, course_id, quiz_id, quiz_params)
update_quiz(canvas, course_id, quiz_id, quiz_params)
canvas |
An object containing the Canvas API key and base URL, obtained through the |
course_id |
The ID of the course containing the quiz to be modified. |
quiz_id |
The ID of the quiz to be modified. |
quiz_params |
A named list of quiz parameters to update. This list can include:
|
A list representing the updated quiz object.
This function uploads a file to the files folder of a specific course.
upload_file(canvas, course_id, file_name)
upload_file(canvas, course_id, file_name)
canvas |
An object containing the Canvas API key and base URL, obtained through the |
course_id |
The ID of the course where the file will be uploaded. |
file_name |
The file to be uploaded. |
A confirmation message indicating that the file has been uploaded.
This function uploads a QTI file to a specified course in Canvas LMS and initiates a content migration. It handles the process of creating the migration, uploading the file, and checking the migration status. Additionally, it allows for obtaining the ID of the resulting quiz within Canvas so that quiz settings are easily updated. In that case, because processing the QTI file (i.e. turning it into a quiz) takes some time, the execution of further commands need to be suspended. If the processing of the uploaded file has not yet resulted in a new quiz ID the user is asked if further waiting is required.
upload_qti_file_with_migration( canvas, course_id, qti_name, wait = FALSE, settings = list() )
upload_qti_file_with_migration( canvas, course_id, qti_name, wait = FALSE, settings = list() )
canvas |
A list containing the 'api_key' and 'base_url' for authentication. |
course_id |
The ID of the course where the QTI file will be uploaded. |
qti_name |
The name of the QTI file (without the '.zip' extension) being uploaded. |
wait |
logical or integer. Defaults to |
settings |
A list of additional settings for the content migration. This can include options like question bank name or overwrite settings. |
A quiz ID (equal to NULL if wait = FALSE or if no new quiz ID was found) and a confirmation message indicating that the content migration has been completed.