Group

class canvasapi.group.Group(requester, attributes)
Parameters:
  • requester (canvasapi.requester.Requester) – The requester to pass HTTP requests through.

  • attributes (dict) – The JSON object to build this object with.

create_content_migration(migration_type, **kwargs)

Create a content migration.

Calls:

POST /api/v1/groups/:group_id/content_migrations

Parameters:

migration_type (str or canvasapi.content_migration.Migrator) – The migrator type to use in this migration

Return type:

canvasapi.content_migration.ContentMigration

create_discussion_topic(**kwargs)

Creates a new discussion topic for the course or group.

Calls:

POST /api/v1/groups/:group_id/discussion_topics

Return type:

canvasapi.discussion_topic.DiscussionTopic

create_external_feed(url, **kwargs)

Create a new external feed for the group.

Calls:

POST /api/v1/groups/:group_id/external_feeds

Parameters:

url (str) – The urlof the external rss or atom feed

Return type:

canvasapi.external_feed.ExternalFeed

create_folder(name, **kwargs)

Creates a folder in this group.

Calls:

POST /api/v1/groups/:group_id/folders

Parameters:

name (str) – The name of the folder.

Return type:

canvasapi.folder.Folder

create_membership(user, **kwargs)

Join, or request to join, a group, depending on the join_level of the group. If the membership or join request already exists, then it is simply returned.

Calls:

POST /api/v1/groups/:group_id/memberships

Parameters:

user (canvasapi.user.User or int) – The object or ID of the user.

Return type:

canvasapi.group.GroupMembership

create_page(wiki_page, **kwargs)

Create a new wiki page.

Calls:

POST /api/v1/groups/:group_id/pages

Parameters:

wiki_page (dict) – Details about the page to create.

Returns:

The created page.

Return type:

canvasapi.page.Page

delete(**kwargs)

Delete a group.

Calls:

DELETE /api/v1/groups/:group_id

Return type:

canvasapi.group.Group

delete_external_feed(feed, **kwargs)

Deletes the external feed.

Calls:

DELETE /api/v1/groups/:group_id/external_feeds/:external_feed_id

Parameters:

feed (canvasapi.external_feed.ExternalFeed or int) – The object or id of the feed to be deleted.

Return type:

canvasapi.external_feed.ExternalFeed

edit(**kwargs)

Edit a group.

Calls:

PUT /api/v1/groups/:group_id

Return type:

canvasapi.group.Group

edit_front_page(**kwargs)

Update the title or contents of the front page.

Calls:

PUT /api/v1/groups/:group_id/front_page

Return type:

canvasapi.page.Page

export_content(export_type, **kwargs)

Begin a content export job for a group.

Calls:

POST /api/v1/groups/:group_id/content_exports

Parameters:

export_type (str) – The type of content to export.

Return type:

canvasapi.content_export.ContentExport

get_activity_stream_summary(**kwargs)

Return a summary of the current user’s global activity stream.

Calls:

GET /api/v1/groups/:group_id/activity_stream/summary

Return type:

dict

get_assignment_override(assignment, **kwargs)

Return override for the specified assignment for this group.

Parameters:

assignment (canvasapi.assignment.Assignment or int) – The assignment to get an override for

Calls:

GET /api/v1/groups/:group_id/assignments/:assignment_id/override

Return type:

canvasapi.assignment.AssignmentOverride

get_collaborations(**kwargs)

Return a list of collaborations for a given course ID.

Calls:

GET /api/v1/groups/:group_id/collaborations

Return type:

canvasapi.collaboration.Collaboration

get_content_export(content_export, **kwargs)

Return information about a single content export.

Calls:

GET /api/v1/groups/:group_id/content_exports/:id

Parameters:

content_export (int or canvasapi.content_export.ContentExport) – The object or ID of the content export to show.

Return type:

canvasapi.content_export.ContentExport

get_content_exports(**kwargs)

Return a paginated list of the past and pending content export jobs for a group.

Calls:

GET /api/v1/groups/:group_id/content_exports

Return type:

canvasapi.paginated_list.PaginatedList of canvasapi.content_export.ContentExport

get_content_migration(content_migration, **kwargs)

Retrive a content migration by its ID

Calls:

GET /api/v1/groups/:group_id/content_migrations/:id

Parameters:

content_migration (int, str or canvasapi.content_migration.ContentMigration) – The object or ID of the content migration to retrieve.

Return type:

canvasapi.content_migration.ContentMigration

get_content_migrations(**kwargs)

List content migrations that the current account can view or manage.

Calls:

GET /api/v1/groups/:group_id/content_migrations/

Return type:

canvasapi.paginated_list.PaginatedList of canvasapi.content_migration.ContentMigration

get_discussion_topic(topic, **kwargs)

Return data on an individual discussion topic.

Calls:

GET /api/v1/groups/:group_id/discussion_topics/:topic_id

Parameters:

topic (canvasapi.discussion_topic.DiscussionTopic or int) – The object or ID of the discussion topic.

Return type:

canvasapi.discussion_topic.DiscussionTopic

get_discussion_topics(**kwargs)

Returns the paginated list of discussion topics for this course or group.

Calls:

GET /api/v1/groups/:group_id/discussion_topics

Return type:

canvasapi.paginated_list.PaginatedList of canvasapi.discussion_topic.DiscussionTopic

get_external_feeds(**kwargs)

Returns the list of External Feeds this group.

Calls:

GET /api/v1/groups/:group_id/external_feeds

Return type:

canvasapi.paginated_list.PaginatedList of canvasapi.external_feed.ExternalFeed

get_file(file, **kwargs)

Return the standard attachment json object for a file.

Calls:

GET /api/v1/groups/:group_id/files/:id

Parameters:

file (canvasapi.file.File or int) – The object or ID of the file to retrieve.

Return type:

canvasapi.file.File

get_file_quota(**kwargs)

Returns the total and used storage quota for the group.

Calls:

GET /api/v1/groups/:group_id/files/quota

Return type:

dict

get_files(**kwargs)

Returns the paginated list of files for the group.

Calls:

GET /api/v1/groups/:group_id/files

Return type:

canvasapi.paginated_list.PaginatedList of canvasapi.file.File

get_folder(folder, **kwargs)

Returns the details for a group’s folder

Calls:

GET /api/v1/groups/:group_id/folders/:id

Parameters:

folder (canvasapi.folder.Folder or int) – The object or ID of the folder to retrieve.

Return type:

canvasapi.folder.Folder

get_folders(**kwargs)

Returns the paginated list of all folders for the given group. This will be returned as a flat list containing all subfolders as well.

Calls:

GET /api/v1/groups/:group_id/folders

Return type:

canvasapi.paginated_list.PaginatedList of canvasapi.folder.Folder

get_full_discussion_topic(topic, **kwargs)

Return a cached structure of the discussion topic.

Calls:

GET /api/v1/groups/:group_id/discussion_topics/:topic_id/view

Parameters:

topic (canvasapi.discussion_topic.DiscussionTopic or int) – The object or ID of the discussion topic.

Return type:

dict

get_licenses(**kwargs)

Returns a paginated list of the licenses that can be applied to the files under the group scope

Calls:

GET /api/v1/groups/:group_id/content_licenses

Return type:

canvasapi.paginated_list.PaginatedList of canvasapi.license.License

get_membership(user, membership_type, **kwargs)

List users in a group.

Calls:

GET /api/v1/groups/:group_id/users/:user_id

or GET /api/v1/groups/:group_id/memberships/:membership_id

Parameters:

user (canvasapi.user.User or int) – list of user ids

Return type:

canvasapi.group.GroupMembership

get_memberships(**kwargs)

List users in a group.

Calls:

GET /api/v1/groups/:group_id/memberships

Return type:

canvasapi.paginated_list.PaginatedList of canvasapi.group.GroupMembership

get_migration_systems(**kwargs)

Return a list of migration systems.

Calls:

GET /api/v1/groups/:group_id/content_migrations/migrators

Return type:

canvasapi.paginated_list.PaginatedList of canvasapi.content_migration.Migrator

get_page(url, **kwargs)

Retrieve the contents of a wiki page.

Calls:

GET /api/v1/groups/:group_id/pages/:url

Parameters:

url (str) – The url for the page.

Returns:

The specified page.

Return type:

canvasapi.groups.Group

get_pages(**kwargs)

List the wiki pages associated with a group.

Calls:

GET /api/v1/groups/:group_id/pages

Return type:

canvasapi.paginated_list.PaginatedList of canvasapi.page.Page

get_tabs(**kwargs)

List available tabs for a group. Returns a list of navigation tabs available in the current context.

Calls:

GET /api/v1/groups/:group_id/tabs

Return type:

canvasapi.paginated_list.PaginatedList of canvasapi.tab.Tab

get_users(**kwargs)

List users in a group.

Calls:

GET /api/v1/groups/:group_id/users

Return type:

canvasapi.paginated_list.PaginatedList of canvasapi.user.User

invite(invitees, **kwargs)

Invite users to group.

Calls:

POST /api/v1/groups/:group_id/invite

Parameters:

invitees (integer list) – list of user ids

Return type:

canvasapi.paginated_list.PaginatedList of canvasapi.group.GroupMembership

preview_html(html, **kwargs)

Preview HTML content processed for this course.

Calls:

POST /api/v1/groups/:group_id/preview_html

Parameters:

html (str) – The HTML code to preview.

Return type:

str

remove_usage_rights(**kwargs)

Removes the usage rights for specified files that are under the current group scope

Calls:

DELETE /api/v1/groups/:group_id/usage_rights

Return type:

dict

remove_user(user, **kwargs)

Leave a group if allowed.

Calls:

DELETE /api/v1/groups/:group_id/users/:user_id

Parameters:

user (canvasapi.user.User or int) – The user object or ID to remove from the group.

Return type:

canvasapi.user.User

reorder_pinned_topics(order, **kwargs)

Puts the pinned discussion topics in the specified order. All pinned topics should be included.

Calls:

POST /api/v1/groups/:group_id/discussion_topics/reorder

Parameters:

order (iterable sequence of values) – The ids of the pinned discussion topics in the desired order. e.g. [104, 102, 103]

Return type:

canvasapi.paginated_list.PaginatedList of canvasapi.discussion_topic.DiscussionTopic

resolve_path(full_path=None, **kwargs)

Returns the paginated list of all of the folders in the given path starting at the group root folder. Returns root folder if called with no arguments.

Calls:

GET /api/v1/groups/group_id/folders/by_path/*full_path

Parameters:

full_path (string) – Full path to resolve, relative to group root.

Return type:

canvasapi.paginated_list.PaginatedList of canvasapi.folder.Folder

set_usage_rights(**kwargs)

Changes the usage rights for specified files that are under the current group scope

Calls:

PUT /api/v1/groups/:group_id/usage_rights

Return type:

canvasapi.usage_rights.UsageRights

show_front_page(**kwargs)

Retrieve the content of the front page.

Calls:

GET /api/v1/groups/:group_id/front_page

Return type:

canvasapi.group.Group

update_membership(user, **kwargs)

Accept a membership request, or add/remove moderator rights.

Calls:

PUT /api/v1/groups/:group_id/users/:user_id

Parameters:

user (canvasapi.user.User or int) – The object or ID of the user.

Return type:

canvasapi.group.GroupMembership

upload(file: PathLike | str | IOBase | FileIO, **kwargs)

Upload a file to the group. Only those with the ‘Manage Files’ permission on a group can upload files to the group. By default, this is anybody participating in the group, or any admin over the group.

Calls:

POST /api/v1/groups/:group_id/files

Parameters:
  • path (str) – The path of the file to upload.

  • file (file or str) – The file or path of the file to upload.

Returns:

True if the file uploaded successfully, False otherwise, and the JSON response from the API.

Return type:

tuple

GroupMembership

class canvasapi.group.GroupMembership(requester, attributes)
Parameters:
  • requester (canvasapi.requester.Requester) – The requester to pass HTTP requests through.

  • attributes (dict) – The JSON object to build this object with.

remove_self(**kwargs)

Leave a group if allowed.

Calls:

DELETE /api/v1/groups/:group_id/memberships/:membership_id

Returns:

An empty dictionary

Return type:

dict

remove_user(user, **kwargs)

Remove user from membership.

Calls:

DELETE /api/v1/groups/:group_id/users/:user_id

Parameters:

user (canvasapi.user.User or int) – The user object or ID to remove from the group.

Returns:

An empty dictionary

Return type:

dict

update(**kwargs)

Accept a membership request, or add/remove moderator rights.

Calls:

PUT /api/v1/groups/:group_id/memberships/:membership_id

Return type:

canvasapi.group.GroupMembership

GroupCategory

class canvasapi.group.GroupCategory(requester, attributes)
Parameters:
  • requester (canvasapi.requester.Requester) – The requester to pass HTTP requests through.

  • attributes (dict) – The JSON object to build this object with.

assign_members(sync=False, **kwargs)

Assign unassigned members.

Calls:

POST /api/v1/group_categories/:group_category_id/assign_unassigned_members

Return type:

canvasapi.paginated_list.PaginatedList of canvasapi.user.User or canvasapi.progress.Progress

create_group(**kwargs)

Create a group.

Calls:

POST /api/v1/group_categories/:group_category_id/groups

Return type:

canvasapi.group.Group

delete(**kwargs)

Delete a group category.

Calls:

DELETE /api/v1/group_categories/:group_category_id

Return type:

empty dict

get_groups(**kwargs)

List groups in group category.

Calls:

GET /api/v1/group_categories/:group_category_id/groups

Return type:

canvasapi.paginated_list.PaginatedList of canvasapi.group.Group

get_users(**kwargs)

List users in group category.

Calls:

GET /api/v1/group_categories/:group_category_id/users

Return type:

canvasapi.paginated_list.PaginatedList of canvasapi.user.User

update(**kwargs)

Update a group category.

Calls:

PUT /api/v1/group_categories/:group_category_id

Return type:

canvasapi.group.GroupCategory