Groups
Groups serve as the data for a few different ideas in Canvas. The first is that they can be a community in the canvas network. The second is that they can be organized by students in a course, for study or communication (but not grading). The third is that they can be organized by teachers or account administrators for the purpose of projects, assignments, and grading. This last kind of group is always part of a group category, which adds the restriction that a user may only be a member of one group per category.
All of these types of groups function similarly, and can be the parent context for many other types of functionality and interaction, such as collections, discussions, wikis, and shared files.
Group memberships are the objects that tie users and groups together.
A Group object looks like:
A GroupMembership object looks like:
GET /api/v1/users/self/groups
GET /api/v1/users/self/groups
Scope: url:GET|/api/v1/users/self/groups
Returns a paginated list of active groups for the current user.
Request Parameters:
Parameter | Type | Description |
---|---|---|
|
| Only include groups that are in this type of context. Allowed values: |
|
|
Allowed values: |
Example Request:
Returns a list of Group objects.
GroupsController#context_index
GET /api/v1/accounts/:account_id/groups
GET /api/v1/accounts/:account_id/groups
Scope: url:GET|/api/v1/accounts/:account_id/groups
GET /api/v1/courses/:course_id/groups
GET /api/v1/courses/:course_id/groups
Scope: url:GET|/api/v1/courses/:course_id/groups
Returns the paginated list of active groups in the given context that are visible to user.
Request Parameters:
Parameter | Type | Description |
---|---|---|
|
| Will only include groups that the user belongs to if this is set |
|
|
Allowed values: |
Example Request:
Returns a list of Group objects.
GET /api/v1/groups/:group_id
GET /api/v1/groups/:group_id
Scope: url:GET|/api/v1/groups/:group_id
Returns the data for a single group, or a 401 if the caller doesn’t have the rights to see it.
Request Parameters:
Parameter | Type | Description |
---|---|---|
|
|
Allowed values: |
Example Request:
Returns a Group object.
POST /api/v1/groups
POST /api/v1/groups
Scope: url:POST|/api/v1/groups
POST /api/v1/group_categories/:group_category_id/groups
POST /api/v1/group_categories/:group_category_id/groups
Scope: url:POST|/api/v1/group_categories/:group_category_id/groups
Creates a new group. Groups created using the “/api/v1/groups/” endpoint will be community groups.
Request Parameters:
Parameter | Type | Description |
---|---|---|
|
| The name of the group |
|
| A description of the group |
|
| whether the group is public (applies only to community groups) |
|
| no description Allowed values: |
|
| The allowed file storage for the group, in megabytes. This parameter is ignored if the caller does not have the manage_storage_quotas permission. |
|
| The sis ID of the group. Must have manage_sis permission to set. |
Example Request:
Returns a Group object.
PUT /api/v1/groups/:group_id
PUT /api/v1/groups/:group_id
Scope: url:PUT|/api/v1/groups/:group_id
Modifies an existing group. Note that to set an avatar image for the group, you must first upload the image file to the group, and the use the id in the response as the argument to this function. See the File Upload Documentation for details on the file upload workflow.
Request Parameters:
Parameter | Type | Description |
---|---|---|
|
| The name of the group |
|
| A description of the group |
|
| Whether the group is public (applies only to community groups). Currently you cannot set a group back to private once it has been made public. |
|
| no description Allowed values: |
|
| The id of the attachment previously uploaded to the group that you would like to use as the avatar image for this group. |
|
| The allowed file storage for the group, in megabytes. This parameter is ignored if the caller does not have the manage_storage_quotas permission. |
|
| An array of user ids for users you would like in the group. Users not in the group will be sent invitations. Existing group members who aren’t in the list will be removed from the group. |
|
| The sis ID of the group. Must have manage_sis permission to set. |
|
| Default is true. If false, any fields containing “sticky” changes will not be updated. See SIS CSV Format documentation for information on which fields can have SIS stickiness |
Example Request:
Returns a Group object.
DELETE /api/v1/groups/:group_id
DELETE /api/v1/groups/:group_id
Scope: url:DELETE|/api/v1/groups/:group_id
Deletes a group and removes all members.
Example Request:
Returns a Group object.
POST /api/v1/groups/:group_id/invite
POST /api/v1/groups/:group_id/invite
Scope: url:POST|/api/v1/groups/:group_id/invite
Sends an invitation to all supplied email addresses which will allow the receivers to join the group.
Request Parameters:
Parameter | Type | Description |
---|---|---|
| Required | An array of email addresses to be sent invitations. |
Example Request:
GET /api/v1/groups/:group_id/users
GET /api/v1/groups/:group_id/users
Scope: url:GET|/api/v1/groups/:group_id/users
Returns a paginated list of users in the group.
Request Parameters:
Parameter | Type | Description |
---|---|---|
|
| The partial name or full ID of the users to match and return in the results list. Must be at least 3 characters. |
|
| “avatar_url”: Include users’ avatar_urls. Allowed values: |
|
| Whether to filter out inactive users from the results. Defaults to false unless explicitly provided. |
Example Request:
Returns a list of User objects.
POST /api/v1/groups/:group_id/files
POST /api/v1/groups/:group_id/files
Scope: url:POST|/api/v1/groups/:group_id/files
Upload a file to the group.
This API endpoint is the first step in uploading a file to a group. See the File Upload Documentation for details on the file upload workflow.
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.
POST /api/v1/groups/:group_id/preview_html
POST /api/v1/groups/:group_id/preview_html
Scope: url:POST|/api/v1/groups/:group_id/preview_html
Preview html content processed for this group
Request Parameters:
Parameter | Type | Description |
---|---|---|
|
| The html content to process |
Example Request:
Example Response:
GroupsController#activity_stream
GET /api/v1/groups/:group_id/activity_stream
GET /api/v1/groups/:group_id/activity_stream
Scope: url:GET|/api/v1/groups/:group_id/activity_stream
Returns the current user’s group-specific activity stream, paginated.
For full documentation, see the API documentation for the user activity stream, in the user api.
GroupsController#activity_stream_summary
GET /api/v1/groups/:group_id/activity_stream/summary
GET /api/v1/groups/:group_id/activity_stream/summary
Scope: url:GET|/api/v1/groups/:group_id/activity_stream/summary
Returns a summary of the current user’s group-specific activity stream.
For full documentation, see the API documentation for the user activity stream summary, in the user api.
GET /api/v1/groups/:group_id/permissions
GET /api/v1/groups/:group_id/permissions
Scope: url:GET|/api/v1/groups/:group_id/permissions
Returns permission information for the calling user in the given group. See also the Account and Course counterparts.
Request Parameters:
Parameter | Type | Description |
---|---|---|
|
| List of permissions to check against the authenticated user. Permission names are documented in the Create a role endpoint. |
Example Request:
Example Response:
GroupMembershipsController#index
GET /api/v1/groups/:group_id/memberships
GET /api/v1/groups/:group_id/memberships
Scope: url:GET|/api/v1/groups/:group_id/memberships
A paginated list of the members of a group.
Request Parameters:
Parameter | Type | Description |
---|---|---|
|
| Only list memberships with the given workflow_states. By default it will return all memberships. Allowed values: |
Example Request:
Returns a list of GroupMembership objects.
GroupMembershipsController#show
GET /api/v1/groups/:group_id/memberships/:membership_id
GET /api/v1/groups/:group_id/memberships/:membership_id
Scope: url:GET|/api/v1/groups/:group_id/memberships/:membership_id
GET /api/v1/groups/:group_id/users/:user_id
GET /api/v1/groups/:group_id/users/:user_id
Scope: url:GET|/api/v1/groups/:group_id/users/:user_id
Returns the group membership with the given membership id or user id.
Example Request:
Returns a GroupMembership object.
GroupMembershipsController#create
POST /api/v1/groups/:group_id/memberships
POST /api/v1/groups/:group_id/memberships
Scope: url:POST|/api/v1/groups/:group_id/memberships
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
Request Parameters:
Parameter | Type | Description |
---|---|---|
|
| no description |
Example Request:
Returns a GroupMembership object.
GroupMembershipsController#update
PUT /api/v1/groups/:group_id/memberships/:membership_id
PUT /api/v1/groups/:group_id/memberships/:membership_id
Scope: url:PUT|/api/v1/groups/:group_id/memberships/:membership_id
PUT /api/v1/groups/:group_id/users/:user_id
PUT /api/v1/groups/:group_id/users/:user_id
Scope: url:PUT|/api/v1/groups/:group_id/users/:user_id
Accept a membership request, or add/remove moderator rights.
Request Parameters:
Parameter | Type | Description |
---|---|---|
|
| Currently, the only allowed value is “accepted” Allowed values: |
|
| no description |
Example Request:
Returns a GroupMembership object.
GroupMembershipsController#destroy
DELETE /api/v1/groups/:group_id/memberships/:membership_id
DELETE /api/v1/groups/:group_id/memberships/:membership_id
Scope: url:DELETE|/api/v1/groups/:group_id/memberships/:membership_id
DELETE /api/v1/groups/:group_id/users/:user_id
DELETE /api/v1/groups/:group_id/users/:user_id
Scope: url:DELETE|/api/v1/groups/:group_id/users/:user_id
Leave a group if you are allowed to leave (some groups, such as sets of course groups created by teachers, cannot be left). You may also use ‘self’ in place of a membership_id.
Example Request:
© Instructure, Inc. Generated on Wed Nov 6 14:20:07 2024 This documentation is generated directly from the Canvas LMS source code, available on Github.
Last updated