Community

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
agatten1
New Member

Using API to Create Groups Based on Number of Students and Have Unique Names

Jump to solution

I'm an instructional designer at a relatively large school. I am relatively new to tapping into Canvas APIs, but I think I am getting the hang of it. I use Postman primarily.

I am looking to create groups in sections of courses prior to course migration and I am running into two problems/questions I can't find answers to.

1) I would use the create group category call, but it generates groups that all have the same name as the group category. Some courses have groups with unique names (eg the group will be titled an assigned topic for the students, which will be different than the category title which might just be "Project Name"). So I was thinking I could create a group category with no groups, then use a different call to create the individual groups, and then after, run a call to assign unassigned members, which seems like it might work. Does that sound right?

2) The second problem I am having that I don't know how to resolve is that Canvas allows you to create however many groups are needed in order for there to be 4 students per group, for example. Some of our courses use this option, and I can't see a way to get that to work through the API. When creating a group category, the parameter group_limit says "Limit the maximum number of users in each group (Course Only). Requires self signup." But I want it to be randomized and automatic when the category is created in the course, not self sign-up, and I want it to generate however many groups are needed for that section for there to be 4 students in each group. Since Canvas can do it, there must be a way to do it through the API, but I can't find documentation on it.

I saw that there is an option to export groups from an existing course and then import them, but since I am working from user-less templates for the copy process, it exports a blank data sheet.

0 Kudos
1 Solution

Accepted Solutions
ColtonSwapp
Instructure
Instructure

Hello @agatten1 

The first question you asked seems correct. You would create a group category with no groups, then use a different call to create the individual groups, and then after, run a call to assign unassigned members . 

For your second question, I am not sure if you have already found this documentation. I am including it just in case.  I think that THIS is the call you would use to assign unassigned members: 

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

They list that: The assigning is done asynchronously by default. If you would like to override this and have the assigning done synchronously, set this value to true.

Was this the call you were making when you were trying to assign students to each of the groups? 

HERE is a link to the APi documentation for canvas. 

View solution in original post

0 Kudos
1 Reply
ColtonSwapp
Instructure
Instructure

Hello @agatten1 

The first question you asked seems correct. You would create a group category with no groups, then use a different call to create the individual groups, and then after, run a call to assign unassigned members . 

For your second question, I am not sure if you have already found this documentation. I am including it just in case.  I think that THIS is the call you would use to assign unassigned members: 

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

They list that: The assigning is done asynchronously by default. If you would like to override this and have the assigning done synchronously, set this value to true.

Was this the call you were making when you were trying to assign students to each of the groups? 

HERE is a link to the APi documentation for canvas. 

0 Kudos